From a74c34208c5ebb4a44a68b759e9dc49304e74652 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Mon, 9 Mar 2026 20:43:02 +0100 Subject: [PATCH] MT#62763 Fix Python code compilation with Python 3.x The code had not been converted to Python 3.x, and was not even compiling there, with something like: $ find -name '*.py' | xargs -n1 python3 -m py_compute Change-Id: I795f931123d1bccb85670fe0dc6b06c46a9f22c2 --- apps/conf_auth/conf_auth.py | 34 +++++++++---------- apps/examples/ivr_examples/b2b_out.py | 4 +-- apps/examples/ivr_examples/call_center.py | 2 +- .../cc_acc_xmlrpc/server/xmlrpcserver.py | 18 +++++----- apps/ivr/py/log.py | 4 +-- apps/mobile_push/load_test/call_gen.py | 2 +- apps/mobile_push/load_test/example_server.py | 4 +-- apps/mobile_push/load_test/reg_client.py | 4 +-- apps/pin_collect/pin_collect.py | 2 +- apps/pin_collect/test/authserver.py | 2 +- apps/py_sems/py/py_sems_log.py | 4 +-- .../prepaid_xmlrpc/server/xmlrpcserver.py | 18 +++++----- apps/webconference/pyqtgui/webconference.py | 28 +++++++-------- 13 files changed, 63 insertions(+), 63 deletions(-) diff --git a/apps/conf_auth/conf_auth.py b/apps/conf_auth/conf_auth.py index fc2a5ac7..3a1ef2dd 100644 --- a/apps/conf_auth/conf_auth.py +++ b/apps/conf_auth/conf_auth.py @@ -39,22 +39,22 @@ class IvrDialog(IvrDialogBase): conf_duration = 0 def sessionInfo(self): - print "IVR Session info:" - print " user: ", self.dialog.user - print " domain: ", self.dialog.domain - print " sip_ip: ", self.dialog.sip_ip - print " sip_port: ", self.dialog.sip_port - print " local_uri: ", self.dialog.local_uri - print " remote_uri: ", self.dialog.remote_uri - print " contact_uri: ", self.dialog.contact_uri - print " callid: ", self.dialog.callid - print " remote_tag: ", self.dialog.remote_tag - print " local_tag: ", self.dialog.local_tag - print " remote_party:", self.dialog.remote_party - print " local_party: ", self.dialog.local_party - print " route: ", self.dialog.route - print " next_hop: ", self.dialog.next_hop - print " cseq: ", self.dialog.cseq + print("IVR Session info:") + print(" user: ", self.dialog.user) + print(" domain: ", self.dialog.domain) + print(" sip_ip: ", self.dialog.sip_ip) + print(" sip_port: ", self.dialog.sip_port) + print(" local_uri: ", self.dialog.local_uri) + print(" remote_uri: ", self.dialog.remote_uri) + print(" contact_uri: ", self.dialog.contact_uri) + print(" callid: ", self.dialog.callid) + print(" remote_tag: ", self.dialog.remote_tag) + print(" local_tag: ", self.dialog.local_tag) + print(" remote_party:", self.dialog.remote_party) + print(" local_party: ", self.dialog.local_party) + print(" route: ", self.dialog.route) + print(" next_hop: ", self.dialog.next_hop) + print(" cseq: ", self.dialog.cseq) def onSessionStart(self): self.sessionInfo() @@ -115,7 +115,7 @@ class IvrDialog(IvrDialogBase): elif self.state == collect: self.setTimer(HINT_TIMER, HINT_TIMEOUT) - def onTimer(self, id): + def onTimer(self, id): if id == HINT_TIMER and self.state == collect: self.enqueue(self.hint_msg, None) elif id == CONF_TIMER and self.state == connected: diff --git a/apps/examples/ivr_examples/b2b_out.py b/apps/examples/ivr_examples/b2b_out.py index e2a73376..988f6f71 100644 --- a/apps/examples/ivr_examples/b2b_out.py +++ b/apps/examples/ivr_examples/b2b_out.py @@ -16,14 +16,14 @@ class IvrDialog(IvrDialogBase): self.enqueue(self.audio_msg,None) def onEmptyQueue(self): - return + return def onTimer(self, timerid): self.disconnectMedia() debug('hello kitty') self.connectCallee(self.dialog.local_party,self.dialog.local_uri, \ self.dialog.remote_party,self.dialog.remote_uri,) - return + return def onBye(self): diff --git a/apps/examples/ivr_examples/call_center.py b/apps/examples/ivr_examples/call_center.py index e803abe3..039c76d5 100644 --- a/apps/examples/ivr_examples/call_center.py +++ b/apps/examples/ivr_examples/call_center.py @@ -30,7 +30,7 @@ class IvrDialog(IvrDialogBase): def onBye(self): - self.stopSession() + self.stopSession() def onEmptyQueue(self): diff --git a/apps/examples/tutorial/cc_acc_xmlrpc/server/xmlrpcserver.py b/apps/examples/tutorial/cc_acc_xmlrpc/server/xmlrpcserver.py index 27218488..365633fe 100644 --- a/apps/examples/tutorial/cc_acc_xmlrpc/server/xmlrpcserver.py +++ b/apps/examples/tutorial/cc_acc_xmlrpc/server/xmlrpcserver.py @@ -8,10 +8,10 @@ server.register_introspection_functions() class MyFuncs: def getCredit(self, arg): - print "Function getCredit" - print " Recieved Pin: ", arg + print("Function getCredit") + print(" Recieved Pin: ", arg) credit=int(arg)+10 - print " Credits: ", credit + print(" Credits: ", credit) return credit def subtractCredit(self, arg): @@ -20,12 +20,12 @@ class MyFuncs: d2 = arg[0] subtract = d2['amount'] credit=1000-subtract - print "Function subtractCredit " - print " Recieved Arg: ", arg[0] - print " methodName: ", d2['methodName'] - print " pin: ", d2['pin'] - print " amount: ", d2['amount'] - print " credit: ", credit + print("Function subtractCredit ") + print(" Recieved Arg: ", arg[0]) + print(" methodName: ", d2['methodName']) + print(" pin: ", d2['pin']) + print(" amount: ", d2['amount']) + print(" credit: ", credit) return credit server.register_instance(MyFuncs()) diff --git a/apps/ivr/py/log.py b/apps/ivr/py/log.py index 3c673178..f5f62b81 100644 --- a/apps/ivr/py/log.py +++ b/apps/ivr/py/log.py @@ -39,9 +39,9 @@ def stacktrace(tb): line = tb.tb_frame.f_lineno if f != last_file: - error('File ' + `f` + ': line ' + `line`) + error('File ' + repr(f) + ': line ' + repr(line)) else: - error(', line ' + `line`) + error(', line ' + repr(line)) return f diff --git a/apps/mobile_push/load_test/call_gen.py b/apps/mobile_push/load_test/call_gen.py index 49501802..724f558b 100755 --- a/apps/mobile_push/load_test/call_gen.py +++ b/apps/mobile_push/load_test/call_gen.py @@ -1,5 +1,5 @@ #!/usr/bin/env python from xmlrpclib import * s = ServerProxy('http://127.0.0.1:8092') -print s.setTarget(100, 1, 0, '4', '192.168.5.110', 2, 0, 30, 40) +print(s.setTarget(100, 1, 0, '4', '192.168.5.110', 2, 0, 30, 40)) diff --git a/apps/mobile_push/load_test/example_server.py b/apps/mobile_push/load_test/example_server.py index b5643087..8187bd83 100644 --- a/apps/mobile_push/load_test/example_server.py +++ b/apps/mobile_push/load_test/example_server.py @@ -26,11 +26,11 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): if __name__ == '__main__': server_class = BaseHTTPServer.HTTPServer httpd = server_class((HOST_NAME, PORT_NUMBER), MyHandler) - print time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER) + print(time.asctime(), "Server Starts - %s:%s" % (HOST_NAME, PORT_NUMBER)) try: httpd.serve_forever() except KeyboardInterrupt: pass httpd.server_close() - print time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER) + print(time.asctime(), "Server Stops - %s:%s" % (HOST_NAME, PORT_NUMBER)) diff --git a/apps/mobile_push/load_test/reg_client.py b/apps/mobile_push/load_test/reg_client.py index 01a4972b..3bce8400 100755 --- a/apps/mobile_push/load_test/reg_client.py +++ b/apps/mobile_push/load_test/reg_client.py @@ -11,10 +11,10 @@ r = set() while True: n = randint(400, 499) if n in r: - print s.removeRegistration(n) + print(s.removeRegistration(n)) r.remove(n) else: - print s.createRegistration(n, str(n), str(n), '192.168.5.110') + print(s.createRegistration(n, str(n), str(n), '192.168.5.110')) r.add(n) time.sleep(.1) \ No newline at end of file diff --git a/apps/pin_collect/pin_collect.py b/apps/pin_collect/pin_collect.py index d7ba7548..7afff5af 100644 --- a/apps/pin_collect/pin_collect.py +++ b/apps/pin_collect/pin_collect.py @@ -56,7 +56,7 @@ class IvrDialog(IvrDialogBase): self.welcome_msg = IvrAudioFile() self.welcome_msg.open(config['welcome_msg'],AUDIO_READ) - self.pin_msg = IvrAudioFile() + self.pin_msg = IvrAudioFile() self.pin_msg.open(config['pin_msg'],AUDIO_READ) self.enqueue(self.welcome_msg,None) diff --git a/apps/pin_collect/test/authserver.py b/apps/pin_collect/test/authserver.py index ec707246..66b9c4b5 100644 --- a/apps/pin_collect/test/authserver.py +++ b/apps/pin_collect/test/authserver.py @@ -20,5 +20,5 @@ server = SimpleXMLRPCServer.SimpleXMLRPCServer(("127.0.0.1", 9090)) server.register_instance(authsrv) #Go into the main listener loop -print "Listening on port 9090" +print("Listening on port 9090") server.serve_forever() diff --git a/apps/py_sems/py/py_sems_log.py b/apps/py_sems/py/py_sems_log.py index cd648ed7..c0b18146 100644 --- a/apps/py_sems/py/py_sems_log.py +++ b/apps/py_sems/py/py_sems_log.py @@ -39,9 +39,9 @@ def stacktrace(tb): line = tb.tb_frame.f_lineno if f != last_file: - error('File ' + `f` + ': line ' + `line`) + error('File ' + repr(f) + ': line ' + repr(line)) else: - error(', line ' + `line`) + error(', line ' + repr(line)) return f diff --git a/apps/sbc/call_control/prepaid_xmlrpc/server/xmlrpcserver.py b/apps/sbc/call_control/prepaid_xmlrpc/server/xmlrpcserver.py index 27218488..365633fe 100644 --- a/apps/sbc/call_control/prepaid_xmlrpc/server/xmlrpcserver.py +++ b/apps/sbc/call_control/prepaid_xmlrpc/server/xmlrpcserver.py @@ -8,10 +8,10 @@ server.register_introspection_functions() class MyFuncs: def getCredit(self, arg): - print "Function getCredit" - print " Recieved Pin: ", arg + print("Function getCredit") + print(" Recieved Pin: ", arg) credit=int(arg)+10 - print " Credits: ", credit + print(" Credits: ", credit) return credit def subtractCredit(self, arg): @@ -20,12 +20,12 @@ class MyFuncs: d2 = arg[0] subtract = d2['amount'] credit=1000-subtract - print "Function subtractCredit " - print " Recieved Arg: ", arg[0] - print " methodName: ", d2['methodName'] - print " pin: ", d2['pin'] - print " amount: ", d2['amount'] - print " credit: ", credit + print("Function subtractCredit ") + print(" Recieved Arg: ", arg[0]) + print(" methodName: ", d2['methodName']) + print(" pin: ", d2['pin']) + print(" amount: ", d2['amount']) + print(" credit: ", credit) return credit server.register_instance(MyFuncs()) diff --git a/apps/webconference/pyqtgui/webconference.py b/apps/webconference/pyqtgui/webconference.py index 402841fc..a7aaea9c 100755 --- a/apps/webconference/pyqtgui/webconference.py +++ b/apps/webconference/pyqtgui/webconference.py @@ -27,7 +27,7 @@ from account import * #CONTROL_URI="http://127.0.0.1:8090/" CONTROL_URI="https://webconference.iptel.org/control" -print "Server Control URI: '%s' - change CONTROL_URI to use local SEMS instance" % CONTROL_URI +print("Server Control URI: '%s' - change CONTROL_URI to use local SEMS instance" % CONTROL_URI) # refresh in ms REFRESH_INTERVAL=1000 @@ -37,7 +37,7 @@ try: from accountconfig import * HAS_ACCOUNT=True except: - print "accountconfig.py not found - will ask for account to make calls" + print("accountconfig.py not found - will ask for account to make calls") pass class named_participant(Ui_participant): @@ -71,7 +71,7 @@ class named_participant(Ui_participant): self.cb_muted.setCheckState(Qt.Unchecked) def muted_changed(self, i): - print "callid is" , self.callid + print("callid is" , self.callid) self.cb_muted.emit(QtCore.SIGNAL("mute(int,bool)"), self.id, self.cb_muted.isChecked()) @@ -107,20 +107,20 @@ class StartQT4(QtGui.QMainWindow): QtCore.QObject.connect(self.ui.buttonNew, QtCore.SIGNAL("clicked()"), self.new_call) self.s = ServerProxy(CONTROL_URI) - print "server has %d running calls " % self.s.calls() + print("server has %d running calls " % self.s.calls()) for i in range(10): self.roomname = "" for n in range(6): self.roomname+=str(random.randint(0,9)) code, result, adminpin, serverstatus = self.s.di('webconference', 'roomCreate', self.roomname) - print "server status: %s " % serverstatus + print("server status: %s " % serverstatus) if code == 0: self.adminpin = adminpin break if self.adminpin == "": raise "oh, could not get a free room :(" - print "roomname is %s, adminpin is %s "% (self.roomname, self.adminpin) + print("roomname is %s, adminpin is %s "% (self.roomname, self.adminpin)) self.ui.label.setText("iptel.org\nwebconference\nhttps://webconference.iptel.org\n\nroom: %s adminpin:%s\n\n" "to dial in call sip:conference@iptel.org \nand type %s*" %(self.roomname, self.adminpin, self.roomname)) @@ -132,7 +132,7 @@ class StartQT4(QtGui.QMainWindow): def timer_hit(self): res = self.s.di('webconference', 'roomInfo', self.roomname, self.adminpin) if res[0] != 0: - print "oh my god, can't see this room!" + print("oh my god, can't see this room!") return code, reason, participants, serverstatus = res @@ -165,31 +165,31 @@ class StartQT4(QtGui.QMainWindow): return part def new_call(self): - print "a new call." + print("a new call.") dlg = QtGui.QDialog(self) dlg_cb = Ui_callbox() dlg_cb.setupUi(dlg) if dlg.exec_() == QDialog.Rejected: return - print "now calling %s " % dlg_cb.num.text() + print("now calling %s " % dlg_cb.num.text()) res = self.s.di('webconference', 'dialout', self.roomname, self.adminpin, str(dlg_cb.num.text()), self.call_user, self.call_domain, self.call_auth_user, self.call_pwd) if res[0] != 0: - print "oh, my dear, calling failed with code %d " % res[0] + print("oh, my dear, calling failed with code %d " % res[0]) return code, result, callid, serverinfo = res - print "code %d result %s " % (code, result) - print "serverinfo is %s " % serverinfo + print("code %d result %s " % (code, result)) + print("serverinfo is %s " % serverinfo) self.createparticipantWidget(dlg_cb.num.text(), callid) def part_ciao(self, id): - print "ciao: ", id + print("ciao: ", id) self.s.di('webconference', 'kickout', self.roomname, self.adminpin, self.participants[id].callid) def part_muted(self, id, s): - print "mute: ", id, " is ", s + print("mute: ", id, " is ", s) if s: self.s.di('webconference', 'mute', self.roomname, self.adminpin, self.participants[id].callid) else: