From cc74efa79ab64b5d41c887a7222250f61e84cdc3 Mon Sep 17 00:00:00 2001 From: max Date: Fri, 5 May 2023 11:08:17 +0200 Subject: [PATCH] Fix assorted instances of leftover Python 3 syntax Closes #1490 --- contrib/src/panda3dtoolsgui/Panda3DToolsGUI.py | 6 +++--- panda/src/iphone/ipfreeze.py | 6 +++--- panda/src/iphone/provision.py | 2 +- panda/src/testbed/test_native_net1.py | 12 ++++++------ panda/src/testbed/test_native_net2.py | 6 +++--- panda/src/testbed/test_native_net3.py | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/contrib/src/panda3dtoolsgui/Panda3DToolsGUI.py b/contrib/src/panda3dtoolsgui/Panda3DToolsGUI.py index 0c8b3f3ccd..331081016b 100644 --- a/contrib/src/panda3dtoolsgui/Panda3DToolsGUI.py +++ b/contrib/src/panda3dtoolsgui/Panda3DToolsGUI.py @@ -1905,7 +1905,7 @@ class main(wx.Frame): self.txaExtraLines.append(line) txafile.close() except: - print "Error opening .txa file!" + print("Error opening .txa file!") self.palettize_saveTxaTxt.SetValue(os.path.join(dirname + os.sep , filename)) dlg.Destroy() @@ -2705,7 +2705,7 @@ class main(wx.Frame): selectedItemIndex = int(self.batchTree.GetItemText(selectedItemId).split()[0])-1 batchItem = self.batchList[selectedItemIndex] - print '\n'+self.BuildCommand(batchItem) + print('\n'+self.BuildCommand(batchItem)) if (batchItem['cmd'].count('maya2egg')): # Display Maya2Egg Tool Panel @@ -2840,7 +2840,7 @@ class main(wx.Frame): self.txaExtraLines.append(line) txafile.close() except: - print "Error opening .txa file!" + print("Error opening .txa file!") self.batchItemNameTxt.SetValue(batchItem['label']) diff --git a/panda/src/iphone/ipfreeze.py b/panda/src/iphone/ipfreeze.py index d7fe343a15..8762b95b63 100755 --- a/panda/src/iphone/ipfreeze.py +++ b/panda/src/iphone/ipfreeze.py @@ -17,8 +17,8 @@ import os from direct.dist import FreezeTool def usage(code, msg = ''): - print >> sys.stderr, __doc__ - print >> sys.stderr, msg + print(__doc__, file=sys.stderr) + print(msg, file=sys.stderr) sys.exit(code) if __name__ == '__main__': @@ -30,7 +30,7 @@ if __name__ == '__main__': try: opts, args = getopt.getopt(sys.argv[1:], 'h') - except getopt.error, msg: + except getopt.error as msg: usage(1, msg) for opt, arg in opts: diff --git a/panda/src/iphone/provision.py b/panda/src/iphone/provision.py index 47a445d3cc..ffdefc6fa0 100755 --- a/panda/src/iphone/provision.py +++ b/panda/src/iphone/provision.py @@ -34,7 +34,7 @@ command = 'env CODESIGN_ALLOCATE="/Developer/Platforms/iPhoneOS.platform/Develop 'xcent' : xcent, } -print command +print(command) result = os.system(command) if result != 0: raise StandardError diff --git a/panda/src/testbed/test_native_net1.py b/panda/src/testbed/test_native_net1.py index 0e4738e8ad..dd96973b16 100644 --- a/panda/src/testbed/test_native_net1.py +++ b/panda/src/testbed/test_native_net1.py @@ -11,7 +11,7 @@ SocketIP.InitNetworkDriver(); addr = SocketAddress() addr.setHost("127.0.0.1",8080) -print addr.getIpPort() +print(addr.getIpPort()) inbound = SocketTCPListen() @@ -23,16 +23,16 @@ while 1 == 1: source = SocketAddress() if inbound.GetIncomingConnection(newsession,source) : #newsession.SetNonBlocking(); - print source.getIpPort() + print(source.getIpPort()) newsession.SendData("Hello From the Listener\n\r"); s = newsession.RecvData(10); - print s - print newsession.GetLastError() + print(s) + print(newsession.GetLastError()) if newsession.ErrorIsWouldBlocking(newsession.GetLastError()) : - print "Reading Would Block" + print("Reading Would Block") else: - print "Not A Blocking Error" + print("Not A Blocking Error") newsession.SendData("GoodBy From the Listener\n\r"); newsession.Close(); diff --git a/panda/src/testbed/test_native_net2.py b/panda/src/testbed/test_native_net2.py index 44c197911b..002b223f53 100644 --- a/panda/src/testbed/test_native_net2.py +++ b/panda/src/testbed/test_native_net2.py @@ -15,7 +15,7 @@ SocketIP.InitNetworkDriver(); addr = SocketAddress() addr.setHost("127.0.0.1",6666) -print addr.getIpPort() +print(addr.getIpPort()) MyConection = BufferedDatagramConnection(0,4096000,4096000,102400); #help(BufferedDatagramConnection) @@ -42,8 +42,8 @@ dg1.addUint16(54321) while 1==1: for x in range(200000): if not MyConection.SendMessage(dg1): - print "Error Sending Message" + print("Error Sending Message") MyConection.Flush(); time.sleep(1) - print "loop" + print("loop") diff --git a/panda/src/testbed/test_native_net3.py b/panda/src/testbed/test_native_net3.py index dff516eb60..d1d9486ee6 100644 --- a/panda/src/testbed/test_native_net3.py +++ b/panda/src/testbed/test_native_net3.py @@ -15,7 +15,7 @@ SocketIP.InitNetworkDriver(); addr = SocketAddress() addr.setHost("127.0.0.1",6666) -print addr.getIpPort() +print(addr.getIpPort()) MyConection = BufferedDatagramConnection(0,4096000,4096000,102400); #help(BufferedDatagramConnection) @@ -47,4 +47,4 @@ while 1==1: MyConection.Flush(); time.sleep(1) - print "loop" + print("loop")