From 507c19e30d7d99d2055a6dbd62fad2104dcdf9f4 Mon Sep 17 00:00:00 2001 From: Gilles DAVID Date: Thu, 30 Mar 2017 19:22:10 +0200 Subject: [PATCH] [PY3] Fix m4 macro for python 3 --- bin/addToKillList.py | 2 +- bin/appliskel/salome | 2 +- .../salome_tester/salome_test_driver_gui.py | 2 +- .../TestConcurrentSession.py | 2 +- .../concurrentSession/usecase_concurrent.sh | 2 +- bin/launchConfigureParser.py | 6 +- bin/nameserver.py | 10 +- bin/runConsole.py | 2 +- bin/runSalome.py | 4 +- bin/server.py | 2 +- bin/setenv.py | 2 +- doc/salome/examples/example1 | 2 +- doc/salome/examples/example12 | 4 +- doc/salome/examples/example13 | 6 +- doc/salome/examples/example14 | 4 +- doc/salome/examples/example15 | 4 +- doc/salome/examples/example16 | 16 +- doc/salome/examples/example17 | 14 +- doc/salome/examples/example18 | 40 ++--- doc/salome/examples/example19 | 156 +++++++++--------- doc/salome/examples/example20 | 30 ++-- doc/salome/examples/example21 | 32 ++-- doc/salome/examples/example22 | 32 ++-- doc/salome/examples/example23 | 2 +- doc/salome/examples/example3 | 16 +- doc/salome/examples/example4 | 8 +- doc/salome/examples/example5 | 4 +- doc/salome/kernel_salome.dox | 2 +- doc/salome/python_doc_compl.dox | 2 +- doc/salome/salome_command.dox | 2 +- salome_adm/unix/config_files/check_swig.m4 | 2 +- salome_adm/unix/config_files/pyembed.m4 | 10 +- salome_adm/unix/config_files/python.m4 | 4 +- src/KERNEL_PY/batchmode_salome.py | 2 +- src/KERNEL_PY/kernel/termcolor.py | 8 +- 35 files changed, 219 insertions(+), 219 deletions(-) diff --git a/bin/addToKillList.py b/bin/addToKillList.py index 685c9e979..06a32f46b 100755 --- a/bin/addToKillList.py +++ b/bin/addToKillList.py @@ -109,7 +109,7 @@ def killList(port=None): pass # kill processes for process_id in process_ids: - #print process_id + # print(process_id) for pid, cmd in list(process_id.items()): try: os.kill(int(pid),signal.SIGKILL) diff --git a/bin/appliskel/salome b/bin/appliskel/salome index e14ccae28..04d60ad32 100755 --- a/bin/appliskel/salome +++ b/bin/appliskel/salome @@ -59,7 +59,7 @@ def main(args): sys.stdout.write(out) if err: sys.stderr.write(err) - #print 'Thank you for using SALOME!' + # print('Thank you for using SALOME!') sys.exit(returncode) except SalomeContextException as e: import logging diff --git a/bin/appliskel/salome_tester/salome_test_driver_gui.py b/bin/appliskel/salome_tester/salome_test_driver_gui.py index 777b17798..c6d856651 100644 --- a/bin/appliskel/salome_tester/salome_test_driver_gui.py +++ b/bin/appliskel/salome_tester/salome_test_driver_gui.py @@ -75,6 +75,6 @@ if __name__ == "__main__": salome_instance.stop() if sys.platform == 'win32': timer.cancel() -# print "Exit test with status code:", res +# print("Exit test with status code:", res) # exit(res) # diff --git a/bin/appliskel/tests/concurrentSession/TestConcurrentSession.py b/bin/appliskel/tests/concurrentSession/TestConcurrentSession.py index d0c066081..095a97be7 100644 --- a/bin/appliskel/tests/concurrentSession/TestConcurrentSession.py +++ b/bin/appliskel/tests/concurrentSession/TestConcurrentSession.py @@ -124,7 +124,7 @@ class TestConcurrentLaunch(unittest.TestCase): if __name__ == "__main__": if not os.path.isfile("hello.py"): with open("hello.py", "w") as f: - f.write("print 'Hello!'") + f.write("print('Hello!')") unittest.main() # diff --git a/bin/appliskel/tests/concurrentSession/usecase_concurrent.sh b/bin/appliskel/tests/concurrentSession/usecase_concurrent.sh index a078fa166..b3a03180c 100755 --- a/bin/appliskel/tests/concurrentSession/usecase_concurrent.sh +++ b/bin/appliskel/tests/concurrentSession/usecase_concurrent.sh @@ -64,7 +64,7 @@ run_command() { # make hello.py echo " #!/usr/bin/env python -print 'Hello\!' +print('Hello\!') " > ${BASE_DIR}/hello.py # Build output folders diff --git a/bin/launchConfigureParser.py b/bin/launchConfigureParser.py index d819dad0f..046f88664 100755 --- a/bin/launchConfigureParser.py +++ b/bin/launchConfigureParser.py @@ -990,7 +990,7 @@ def get_env(theAdditionalOptions=None, appname=salomeappname, cfgname=salomecfgn args = _opts args['user_config'] = user_config - #print "User Configuration file: ", args['user_config'] + # print("User Configuration file: ", args['user_config']) # set default values for options which are NOT set in config files for aKey in listKeys: @@ -1183,7 +1183,7 @@ def get_env(theAdditionalOptions=None, appname=salomeappname, cfgname=salomecfgn elif os.path.exists( os.path.join(d2,"{0}.xml".format(salomeappname)) ): dirs.append( d2 ) else: - #print "* '"+m+"' should be deleted from ",args[modules_nam] + # print("* '"+m+"' should be deleted from ",args[modules_nam]) pass # Test @@ -1220,5 +1220,5 @@ def get_env(theAdditionalOptions=None, appname=salomeappname, cfgname=salomecfgn # return arguments os.environ[config_var] = os.pathsep.join(dirs) - #print "Args: ", args + # print("Args: ", args) return args diff --git a/bin/nameserver.py b/bin/nameserver.py index 5f806971e..9000341d7 100755 --- a/bin/nameserver.py +++ b/bin/nameserver.py @@ -52,7 +52,7 @@ class NamingServer(Server): hname = getShortHostName(); else: hname = socket.gethostname(); - #print "hname=",hname + # print("hname=",hname) with open(os.environ["OMNIORB_CONFIG"]) as f: ss = re.findall("NameService=corbaname::" + hname + ":\d+", f.read()) @@ -73,7 +73,7 @@ class NamingServer(Server): try: os.mkdir(upath) except: - #print "Can't create " + upath + # print("Can't create " + upath) pass #os.system("touch " + upath + "/dummy") @@ -85,11 +85,11 @@ class NamingServer(Server): #os.system("rm -f " + upath + "/omninames* " + upath + "/dummy " + upath + "/*.log") #aSedCommand="s/.*NameService=corbaname::" + hname + ":\([[:digit:]]*\)/\1/" - #print "sed command = ", aSedCommand + # print("sed command = ", aSedCommand) #aPort = commands.getoutput("sed -e\"" + aSedCommand + "\"" + os.environ["OMNIORB_CONFIG"]) - #print "port=", aPort + # print("port=", aPort) if sys.platform == "win32": - #print "start omniNames -start " + aPort + " -logdir " + upath + # print("start omniNames -start " + aPort + " -logdir " + upath) self.CMD = ['omniNames', '-start' , aPort , '-nohostname', '-logdir' , os.path.realpath(upath), '-errlog', os.path.realpath(os.path.join(upath,'omniNameErrors.log'))] #os.system("start omniNames -start " + aPort + " -logdir " + upath) else: diff --git a/bin/runConsole.py b/bin/runConsole.py index ee53a2fbf..8e3e25b6a 100644 --- a/bin/runConsole.py +++ b/bin/runConsole.py @@ -46,7 +46,7 @@ ask user to select a port from list of available SALOME instances.\n The -c option can be used to specify the command to execute in the interpreter. A script can also be used. For example: - salome connect -p 2810 -c 'print "Hello"' + salome connect -p 2810 -c 'print("Hello")' salome connect -p 2810 hello.py """ parser = MyParser(usage=usage, epilog=epilog) diff --git a/bin/runSalome.py b/bin/runSalome.py index 6632e5306..3bbf51e3c 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -501,7 +501,7 @@ def startSalome(args, modules_list, modules_root_dir): # and wait until it is registered in naming service # - #print "ARGS = ",args + # print("ARGS = ",args) if ('study' not in args['embedded']) | (args["gui"] == 0): print("RunStudy") myServer=SalomeDSServer(args) @@ -630,7 +630,7 @@ def useSalome(args, modules_list, modules_root_dir): print() print("--- Error during Salome launch ---") - #print process_id + # print(process_id) from addToKillList import addToKillList from killSalomeWithPort import getPiDict diff --git a/bin/server.py b/bin/server.py index 3b9736323..ce1c7927b 100755 --- a/bin/server.py +++ b/bin/server.py @@ -71,7 +71,7 @@ class Server: + os.getenv("LD_LIBRARY_PATH")] myargs = myargs +['-T']+self.CMD[:1]+['-e'] + env_ld_library_path command = myargs + self.CMD - #print "command = ", command + # print("command = ", command) if sys.platform == "win32": import subprocess pid = subprocess.Popen(command).pid diff --git a/bin/setenv.py b/bin/setenv.py index f09ea5610..6019b8905 100755 --- a/bin/setenv.py +++ b/bin/setenv.py @@ -98,7 +98,7 @@ def get_config(silent=False, exeName=None): #*** Test additional option #*** args = launchConfigureParser.get_env([o_j]) - #*** if args.has_key("join"): print args["join"] + #*** if args.has_key("join"): print(args["join"]) # Check variables _ROOT_DIR # and set list of used modules (without KERNEL) diff --git a/doc/salome/examples/example1 b/doc/salome/examples/example1 index eae882cae..a7d937fdb 100644 --- a/doc/salome/examples/example1 +++ b/doc/salome/examples/example1 @@ -19,7 +19,7 @@ file = str+"/test.hdf" #file = "/tmp/ggg.hdf" -print " ------- We will save to", file, "-----------" +print(" ------- We will save to", file, "-----------") batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy) openedStudy=batchmode_geompy.myStudyManager.Open(file) diff --git a/doc/salome/examples/example12 b/doc/salome/examples/example12 index 760587736..57dd18615 100644 --- a/doc/salome/examples/example12 +++ b/doc/salome/examples/example12 @@ -19,7 +19,7 @@ A.SetTextColor(color) c = A.TextColor(); if c.R != 234 or c.G != 345 or c.B != 231: - print "Error: wrong value of AttributeTextColor" + print("Error: wrong value of AttributeTextColor") # save / restore study #============================================================ @@ -53,5 +53,5 @@ if A == None : c = A.TextColor(); if c.R != 234 or c.G != 345 or c.B != 231: - print "Error: wrong value of AttributeTextColor" + print("Error: wrong value of AttributeTextColor") diff --git a/doc/salome/examples/example13 b/doc/salome/examples/example13 index c05aaff52..b43a8574c 100644 --- a/doc/salome/examples/example13 +++ b/doc/salome/examples/example13 @@ -19,7 +19,7 @@ A.SetTextHighlightColor(highlightcolor) c = A.TextHighlightColor(); if c.R != 256 or c.G != 256 or c.B != 256: - print "Error: wrong value of AttributeTextHighlightColor" + print("Error: wrong value of AttributeTextHighlightColor") # save / restore study @@ -44,7 +44,7 @@ if father is None: #============================================================ res, A = father.FindAttribute("AttributeTextHighlightColor") -print res, A +print(res, A) if res == 0 or A == None: raise RuntimeError, "Error: not found AttributeTextHighlightColor" @@ -56,5 +56,5 @@ if A == None : c = A.TextHighlightColor(); if c.R != 256 or c.G != 256 or c.B != 256: - print "Error: wrong value of AttributeTextTextHighlightColor" + print("Error: wrong value of AttributeTextTextHighlightColor") diff --git a/doc/salome/examples/example14 b/doc/salome/examples/example14 index a0acf346d..87348b5fa 100644 --- a/doc/salome/examples/example14 +++ b/doc/salome/examples/example14 @@ -9,7 +9,7 @@ aPixmap = A._narrow(SALOMEDS.AttributePixMap); aPixmap.SetPixMap( "ICON_OBJBROWSER_Geometry" ); if aPixmap.GetPixMap() != "ICON_OBJBROWSER_Geometry": - print "Error: wrong value of AttributePixMap" + print("Error: wrong value of AttributePixMap") # save / restore study @@ -43,5 +43,5 @@ if A == None : raise RuntimeError, "Can't create AttributePixMap attribute" if A.GetPixMap() != "ICON_OBJBROWSER_Geometry": - print "Error: wrong value of AttributePixMap" + print("Error: wrong value of AttributePixMap") diff --git a/doc/salome/examples/example15 b/doc/salome/examples/example15 index 42493fe01..4ba2ec4d5 100644 --- a/doc/salome/examples/example15 +++ b/doc/salome/examples/example15 @@ -9,7 +9,7 @@ A = A._narrow(SALOMEDS.AttributeLocalID) A.SetValue(763242882) if A.Value() != 763242882: - print "Error: wrong value of AttributeLocalID" + print("Error: wrong value of AttributeLocalID") # save / restore study #================================= @@ -39,5 +39,5 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeLocalID) if A.Value() != 763242882: - print "Error: wrong value of AttributeLocalID" + print("Error: wrong value of AttributeLocalID") diff --git a/doc/salome/examples/example16 b/doc/salome/examples/example16 index 3be50d9b6..d05c9a83c 100644 --- a/doc/salome/examples/example16 +++ b/doc/salome/examples/example16 @@ -21,7 +21,7 @@ A.Add(300) A.Add(500) A.Add(400) A.Add(700) -print "First transaction goes on : HasOpenCommand() = ", batchmode_geompy.myBuilder.HasOpenCommand() +print("First transaction goes on : HasOpenCommand() = ", batchmode_geompy.myBuilder.HasOpenCommand()) batchmode_geompy.myBuilder.CommitCommand() #-------------- # 2nd transaction ------------------------------------------ @@ -34,7 +34,7 @@ if batchmode_geompy.myBuilder.GetAvailableUndos() == 0: raise RuntimeError, "GetAvailableUndos() = 0 but must not !" if A.Length() != 4: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 500: raise RuntimeError, "Wrong value of AttributeSequenceOfInteger" @@ -47,9 +47,9 @@ res, A = batchmode_geompy.myBuilder.FindAttribute(batchmode_geompy.father, "Attr if A is None: raise RuntimeError, "After first 'undo' can't find AttributeSequenceOfInteger" if A.Length() != 5: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 500 or A.Value(4) != 400 or A.Value(5) != 700: - print A.Value(1), A.Value(2), A.Value(3), A.Value(4), A.Value(5) + print( A.Value(1), A.Value(2), A.Value(3), A.Value(4), A.Value(5)) raise RuntimeError, "Wrong value of AttributeSequenceOfInteger after the first 'undo'!" # save file2 = dir + "/test2.hdf" @@ -73,7 +73,7 @@ res, A = batchmode_geompy.myBuilder.FindAttribute(batchmode_geompy.father, "Attr if res ==0 or A== None : raise RuntimeError, "AttributeSequenceOfInteger is not found but must be!" if A.Length() != 4: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 500: raise RuntimeError, "Wrong value of AttributeSequenceOfInteger" @@ -100,9 +100,9 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeSequenceOfInteger) if A.Length() != 4: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 500: - print "Wrong value of AttributeSequenceOfInteger" + print("Wrong value of AttributeSequenceOfInteger") #---------------------------------------------------------------------- openedStudy=batchmode_geompy.myStudyManager.Open(file2); @@ -125,7 +125,7 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeSequenceOfInteger) if A.Length() != 5: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 500 or A.Value(4) != 400 or A.Value(5) != 700: raise RuntimeError, "Wrong value of AttributeSequenceOfInteger after the first 'undo'!" diff --git a/doc/salome/examples/example17 b/doc/salome/examples/example17 index 2c3e6b819..2ffd4ee03 100644 --- a/doc/salome/examples/example17 +++ b/doc/salome/examples/example17 @@ -51,7 +51,7 @@ if A == None : A.SetValue("AttributesTesting") if A.Value() != "AttributesTesting": - print "Wrong value of AttributeName" + print("Wrong value of AttributeName") batchmode_geompy.myBuilder.CommitCommand() @@ -130,11 +130,11 @@ batchmode_geompy.myBuilder.CommitCommand() #=========================================================== res, A = batchmode_geompy.myBuilder.FindAttribute(child, "AttributeComment") -print "res = ", res +print("res = ", res) if A != None : - print " AttributeComment was found" + print(" AttributeComment was found") else: - print " AttributeComment is not found. It's correct" + print(" AttributeComment is not found. It's correct") attributes=[] @@ -142,12 +142,12 @@ attributes = child.GetAllAttributes() length = len(attributes) -print "Attributes number = ", length -print attributes +print("Attributes number = ", length) +print(attributes) for i in range(0, length) : attr = attributes[i] if attr is None : - print i,"None item of object attributes list" + print(i,"None item of object attributes list") if length != 5 : raise RuntimeError, "Wrong number of attributes" diff --git a/doc/salome/examples/example18 b/doc/salome/examples/example18 index 477f8b2b6..b2423ab89 100644 --- a/doc/salome/examples/example18 +++ b/doc/salome/examples/example18 @@ -135,29 +135,29 @@ N32.SetFather(N3) N32.Prepend(N31) N33.InsertAfter(N32) N33.Append(N34) -print "------------- ", N1, " ------------- " -print "N1.Label() = ", N1.Label() , "IsRoot() = ", N1.IsRoot(), "Depth() = ", N1.Depth() -print "N11.Label() = ", N11.Label() , "IsRoot() = ", N11.IsRoot(), "Depth() = ", N11.Depth() -print "N111.Label() = ", N111.Label() , "IsRoot() = ", N111.IsRoot(), "Depth() = ", N111.Depth() -print "N2.Label() = ", N2.Label() , "IsRoot() = ", N2.IsRoot(), "Depth() = ", N2.Depth() -print "N3.Label() = ", N3.Label() , "IsRoot() = ", N3.IsRoot(), "Depth() = ", N3.Depth() -print "N31.Label() = ", N31.Label() , "IsRoot() = ", N31.IsRoot(), "Depth() = ", N31.Depth() -print "N32.Label() = ", N32.Label() , "IsRoot() = ", N32.IsRoot(), "Depth() = ", N32.Depth() -print "N321.Label() = ", N321.Label() , "IsRoot() = ", N321.IsRoot(), "Depth() = ", N321.Depth() -print "N33.Label() = ", N33.Label() , "IsRoot() = ", N33.IsRoot(), "Depth() = ", N33.Depth() -print "N34.Label() = ", N34.Label() , "IsRoot() = ", N34.IsRoot(), "Depth() = ", N34.Depth() -print "N1.IsRoot()=", N1.IsRoot() - -print "N1.HasNext() = ",N1.HasNext() +print("------------- ", N1, " ------------- ") +print("N1.Label() = ", N1.Label() , "IsRoot() = ", N1.IsRoot(), "Depth() = ", N1.Depth()) +print("N11.Label() = ", N11.Label() , "IsRoot() = ", N11.IsRoot(), "Depth() = ", N11.Depth()) +print("N111.Label() = ", N111.Label() , "IsRoot() = ", N111.IsRoot(), "Depth() = ", N111.Depth()) +print("N2.Label() = ", N2.Label() , "IsRoot() = ", N2.IsRoot(), "Depth() = ", N2.Depth()) +print("N3.Label() = ", N3.Label() , "IsRoot() = ", N3.IsRoot(), "Depth() = ", N3.Depth()) +print("N31.Label() = ", N31.Label() , "IsRoot() = ", N31.IsRoot(), "Depth() = ", N31.Depth()) +print("N32.Label() = ", N32.Label() , "IsRoot() = ", N32.IsRoot(), "Depth() = ", N32.Depth()) +print("N321.Label() = ", N321.Label() , "IsRoot() = ", N321.IsRoot(), "Depth() = ", N321.Depth()) +print("N33.Label() = ", N33.Label() , "IsRoot() = ", N33.IsRoot(), "Depth() = ", N33.Depth()) +print("N34.Label() = ", N34.Label() , "IsRoot() = ", N34.IsRoot(), "Depth() = ", N34.Depth()) +print("N1.IsRoot()=", N1.IsRoot()) + +print("N1.HasNext() = ",N1.HasNext()) if N1.HasNext(): - print N1.Next().Label() + print(N1.Next().Label()) -print "N32.HasPrevious() = ",N32.HasPrevious() +print("N32.HasPrevious() = ",N32.HasPrevious()) if N32.HasPrevious(): - print N32.GetPrevious().Label() + print(N32.GetPrevious().Label()) -print "N111.HasFirst()=",N111.HasFirst() -print "N111.HasFather()=",N111.HasFather() +print("N111.HasFirst()=",N111.HasFirst()) +print("N111.HasFather()=",N111.HasFather()) if N111.HasFather() : - print "N111.GetFather().Label()=",N111.GetFather().Label() + print("N111.GetFather().Label()=",N111.GetFather().Label()) diff --git a/doc/salome/examples/example19 b/doc/salome/examples/example19 index 4cf37eb34..71efad361 100644 --- a/doc/salome/examples/example19 +++ b/doc/salome/examples/example19 @@ -36,7 +36,7 @@ ShapeType = batchmode_smesh.ShapeType subShapeList = batchmode_geompy.SubShapeAll(box,ShapeType["Face"]) face=subShapeList[0] name = "box_face" -print name +print(name) idface= batchmode_geompy.addToStudyInFather(box,face,name) # ---- add shell from box in study @@ -44,7 +44,7 @@ idface= batchmode_geompy.addToStudyInFather(box,face,name) subShellList= batchmode_geompy.SubShapeAll(box,ShapeType["Shell"]) shell = subShellList[0] name = "box_shell" -print name +print(name) idshell= batchmode_geompy.addToStudyInFather(box,shell,name) # ---- add first edge of face in study @@ -52,7 +52,7 @@ idshell= batchmode_geompy.addToStudyInFather(box,shell,name) edgeList = batchmode_geompy.SubShapeAll(face,ShapeType["Edge"]) edge=edgeList[0]; name = "face_edge" -print name +print(name) idedge= batchmode_geompy.addToStudyInFather(face,edge,name) # ---- launch SMESH, init a Mesh with the box @@ -70,73 +70,73 @@ batchmode_smesh.SetShape(idbox, idmesh); # ---- create Hypothesis -print "-------------------------- create Hypothesis ----------------------" -print "-------------------------- LocalLength" +print("-------------------------- create Hypothesis ----------------------") +print("-------------------------- LocalLength") hyp1 = smesh.CreateHypothesis("LocalLength", batchmode_geompy.myStudyId ) hypLen1 = hyp1._narrow(SMESH.SMESH_LocalLength) hypLen1.SetLength(100) -print hypLen1.GetName() -print hypLen1.GetId() -print hypLen1.GetLength() +print(hypLen1.GetName()) +print(hypLen1.GetId()) +print(hypLen1.GetLength()) idlength = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypLen1) ); batchmode_smesh.SetName(idlength, "Local_Length_100"); -print "-------------------------- NumberOfSegments" +print("-------------------------- NumberOfSegments") hyp2 = smesh.CreateHypothesis("NumberOfSegments", batchmode_geompy.myStudyId ) hypNbSeg1=hyp2._narrow(SMESH.SMESH_NumberOfSegments) hypNbSeg1.SetNumberOfSegments(7) -print hypNbSeg1.GetName() -print hypNbSeg1.GetId() -print hypNbSeg1.GetNumberOfSegments() +print(hypNbSeg1.GetName()) +print(hypNbSeg1.GetId()) +print(hypNbSeg1.GetNumberOfSegments()) idseg = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypNbSeg1) ); batchmode_smesh.SetName(idseg, "NumberOfSegments_7"); -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") hyp3 = smesh.CreateHypothesis("MaxElementArea", batchmode_geompy.myStudyId) hypArea1=hyp3._narrow(SMESH.SMESH_MaxElementArea) hypArea1.SetMaxElementArea(2500) -print hypArea1.GetName() -print hypArea1.GetId() -print hypArea1.GetMaxElementArea() +print(hypArea1.GetName()) +print(hypArea1.GetId()) +print(hypArea1.GetMaxElementArea()) idarea1 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea1) ); batchmode_smesh.SetName(idarea1, "MaxElementArea_2500"); -print "-------------------------- MaxElementArea" +print("-------------------------- MaxElementArea") hyp3 = smesh.CreateHypothesis("MaxElementArea", batchmode_geompy.myStudyId) hypArea2 = hyp3._narrow(SMESH.SMESH_MaxElementArea) hypArea2.SetMaxElementArea(500) -print hypArea2.GetName() -print hypArea2.GetId() -print hypArea2.GetMaxElementArea() +print(hypArea2.GetName()) +print(hypArea2.GetId()) +print(hypArea2.GetMaxElementArea()) idarea2 = batchmode_smesh.AddNewHypothesis( orb.object_to_string(hypArea2) ); batchmode_smesh.SetName(idarea2, "MaxElementArea_500"); -print "-------------------------- Regular_1D" +print("-------------------------- Regular_1D") alg1 = smesh.CreateHypothesis("Regular_1D", batchmode_geompy.myStudyId) algo1 = alg1._narrow(SMESH.SMESH_Algo) listHyp = algo1.GetCompatibleHypothesis() for hyp in listHyp: - print hyp + print(hyp) algoReg=alg1._narrow(SMESH.SMESH_Regular_1D) -print algoReg.GetName() -print algoReg.GetId() +print(algoReg.GetName()) +print(algoReg.GetId()) idreg = batchmode_smesh.AddNewAlgorithms( orb.object_to_string(algoReg) ); batchmode_smesh.SetName(idreg, "Regular_1D"); -print "-------------------------- MEFISTO_2D" +print("-------------------------- MEFISTO_2D") alg2 = smesh.CreateHypothesis("MEFISTO_2D", batchmode_geompy.myStudyId) algo2 = alg2._narrow(SMESH.SMESH_Algo) listHyp=algo2.GetCompatibleHypothesis() for hyp in listHyp: - print hyp + print(hyp) algoMef=alg2._narrow(SMESH.SMESH_MEFISTO_2D) -print algoMef.GetName() -print algoMef.GetId() +print(algoMef.GetName()) +print(algoMef.GetId()) idmef = batchmode_smesh.AddNewAlgorithms( orb.object_to_string(algoMef) ); batchmode_smesh.SetName(idmef, "MEFISTO_2D"); @@ -144,13 +144,13 @@ batchmode_smesh.SetName(idmef, "MEFISTO_2D"); # ---- add hypothesis to edge -print "-------------------------- add hypothesis to edge" +print("-------------------------- add hypothesis to edge") edge = batchmode_geompy.IDToObject(idedge) submesh = mesh.GetElementsOnShape(edge) ret = mesh.AddHypothesis(edge,algoReg) -print ret +print(ret) ret=mesh.AddHypothesis(edge,hypLen1) -print ret +print(ret) idsm1 = batchmode_smesh.AddSubMeshOnShape( idmesh, idedge, @@ -160,11 +160,11 @@ batchmode_smesh.SetName(idsm1, "SubMeshEdge") batchmode_smesh.SetAlgorithms( idsm1, idreg ); batchmode_smesh.SetHypothesis( idsm1, idlength ); -print "-------------------------- add hypothesis to face" +print("-------------------------- add hypothesis to face") face=batchmode_geompy.IDToObject(idface) submesh=mesh.GetElementsOnShape(face) ret=mesh.AddHypothesis(face,hypArea2) -print ret +print(ret) idsm2 = batchmode_smesh.AddSubMeshOnShape( idmesh, idface, @@ -175,17 +175,17 @@ batchmode_smesh.SetHypothesis( idsm2, idarea2 ); # ---- add hypothesis to box -print "-------------------------- add hypothesis to box" +print("-------------------------- add hypothesis to box") box=batchmode_geompy.IDToObject(idbox) submesh=mesh.GetElementsOnShape(box) ret=mesh.AddHypothesis(box,algoReg) -print ret +print(ret) ret=mesh.AddHypothesis(box,hypNbSeg1) -print ret +print(ret) ret=mesh.AddHypothesis(box,algoMef) -print ret +print(ret) ret=mesh.AddHypothesis(box,hypArea1) -print ret +print(ret) batchmode_smesh.SetAlgorithms( idmesh, idreg ); batchmode_smesh.SetHypothesis( idmesh, idseg ); @@ -194,12 +194,12 @@ batchmode_smesh.SetHypothesis( idmesh, idarea1 ); # ---- compute box -print "-------------------------- compute box" +print("-------------------------- compute box") ret=smesh.Compute(mesh,box) -print ret +print(ret) log=mesh.GetLog(0); # no erase trace for linelog in log: - print linelog + print(linelog) #======================================================= @@ -212,12 +212,12 @@ dir= os.getenv("SUPERV_ROOT_DIR") if dir == None: raise RuntimeError, "SUPERV_ROOT_DIR is not defined" xmlfile = dir +"/examples/GraphEssai.xml" -print "--------------\n"+xmlfile+"\n--------------\n" +print("--------------\n"+xmlfile+"\n--------------\n") myGraph = Graph ( xmlfile ) # This DataFlow is "valid" : no loop, correct links between Nodes etc... -print myGraph.IsValid() +print(myGraph.IsValid()) # Get Nodes myGraph.PrintNodes() @@ -235,61 +235,61 @@ Mulz = Mul.Port('z') Divz = Div.Port('z') # This DataFlow is "executable" : all pending Ports are defined with Datas -print myGraph.IsExecutable() +print(myGraph.IsExecutable()) # Starts only execution of that DataFlow and gets control immediatly -print myGraph.Run() +print(myGraph.Run()) # That DataFlow is running ==> 0 (false) -print myGraph.IsDone() +print(myGraph.IsDone()) # Events of execution : aStatus,aNode,anEvent,aState = myGraph.Event() while aStatus : - print aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState + print(aNode.Thread(),aNode.SubGraph(),aNode.Name(),anEvent,aState) aStatus,aNode,anEvent,aState = myGraph.Event() -print myGraph.IsDone() +print(myGraph.IsDone()) # Wait for Completion (but it is already done after event loop ...) -print "Done : ",myGraph.DoneW() +print("Done : ",myGraph.DoneW()) # Get result -print "Result : ",Divz.ToString() +print("Result : ",Divz.ToString()) # Intermediate results : -print "Intermediate Result Add\z : ",Addz.ToString() -print "Intermediate Result Sub\z : ",Subz.ToString() -print "Intermediate Result Mul\z : ",Mulz.ToString() +print("Intermediate Result Add\z : ",Addz.ToString()) +print("Intermediate Result Sub\z : ",Subz.ToString()) +print("Intermediate Result Mul\z : ",Mulz.ToString()) -print " " -#print "Type : print myGraph.IsDone()" -#print " If execution is finished ==> 1 (true)" +print(" ") +#print("Type : print(myGraph.IsDone()") +#print(" If execution is finished ==> 1 (true)") res=myGraph.IsDone() if res != 1: raise RuntimeError, "myGraph.Run() is not done" -print " " -print "Type : print Divz.ToString()" -print " You will get the result" +print(" ") +print("Type : print(Divz.ToString()") +print(" You will get the result") Divz.ToString() -print " " -print "Type : myGraph.PrintPorts()" -print " to see input and output values of the graph" +print(" ") +print("Type : myGraph.PrintPorts()") +print(" to see input and output values of the graph") myGraph.PrintPorts() -print " " -print "Type : Add.PrintPorts()" +print(" ") +print("Type : Add.PrintPorts()") Add.PrintPorts() -print "Type : Sub.PrintPorts()" +print("Type : Sub.PrintPorts()") Sub.PrintPorts() -print "Type : Mul.PrintPorts()" +print("Type : Mul.PrintPorts()") Mul.PrintPorts() -print "Type : Div.PrintPorts()" -print " to see input and output values of nodes" +print("Type : Div.PrintPorts()") +print(" to see input and output values of nodes") Div.PrintPorts() # Export will create newsupervisionexample.xml and the corresponding .py file @@ -297,21 +297,21 @@ tmpdir=os.getenv("TmpDir") if tmpdir is None: tmpdir="/tmp" file = tmpdir + "/newsupervisionexample" -print "--------------\n"+file+"\n--------------\n" +print("--------------\n"+file+"\n--------------\n") myGraph.Export(file) ior = batchmode_geompy.orb.object_to_string(myGraph.G) addStudy(ior) GraphName = myGraph.Name() -print "Befor save ", +print("Befor save ",) nodes = myGraph.Nodes() length_bs = len(nodes) -print "ListOfNodes length = ", length_bs +print("ListOfNodes length = ", length_bs) names=[] for node in nodes: names.append(node.Name()) -print names +print(names) #================================= @@ -326,7 +326,7 @@ file = str+"/test.hdf" #================================================== #1. SaveAs #================================================== -print " ------- We will save to", file, "-----------" +print(" ------- We will save to", file, "-----------") batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy) batchmode_geompy.myStudyManager.Close(batchmode_geompy.myStudy) @@ -336,13 +336,13 @@ batchmode_geompy.myStudyManager.Close(batchmode_geompy.myStudy) os.mkdir(str + "/test_dir") #2.================================================== -print " ------- We rename the file as " + str + "/test_dir/test_new.hdf" +print(" ------- We rename the file as " + str + "/test_dir/test_new.hdf") os.rename(file, str+"/test_dir/test_new.hdf") #================================================== #3. Open #================================================== -print " ------- We try to open " + str + "/test_dir/test_new.hdf" +print(" ------- We try to open " + str + "/test_dir/test_new.hdf") try: openedStudy=batchmode_geompy.myStudyManager.Open(str+"/test_dir/test_new.hdf") @@ -417,7 +417,7 @@ aChildIterator = openedStudy.NewChildIterator(father) #while aChildIterator.More(): anSObject = aChildIterator.Value() -#print "iterate: ", anSObject.GetID() +#print("iterate: ", anSObject.GetID()) res, anAttr=anSObject.FindAttribute("AttributeIOR") if res : anAttr=anAttr._narrow(SALOMEDS.AttributeIOR) @@ -425,7 +425,7 @@ if res : Graph=SuperV.getGraph(ior) ListOfNodes=Graph.Nodes() length_as= len(ListOfNodes) - print "ListOfNodes length = ", length_as + print("ListOfNodes length = ", length_as) if length_as != length_bs: raise RuntimeErrror, "defferent length of nodes after study open" #aChildIterator.Next() @@ -525,7 +525,7 @@ if res : Graph=SuperV.getGraph(ior) ListOfNodes=Graph.Nodes() length_as= len(ListOfNodes) - print "ListOfNodes length = ", length_as + print("ListOfNodes length = ", length_as) if length_as != length_bs: raise RuntimeErrror, "defferent length of nodes after study open" #aChildIterator.Next() diff --git a/doc/salome/examples/example20 b/doc/salome/examples/example20 index 9326da115..64ff48f36 100644 --- a/doc/salome/examples/example20 +++ b/doc/salome/examples/example20 @@ -20,22 +20,22 @@ if A == None : A = A._narrow(SALOMEDS.AttributeStudyProperties) batchmode_geompy.myBuilder.NewCommand(); -print "A.GetUserName()= ", A.GetUserName() +print("A.GetUserName()= ", A.GetUserName()) res,mm,hh,dd,mnth,yy=A.GetCreationDate() -print "A.GetCreationDate() = ", mm,hh,dd,mnth,yy -print "A.GetCreationMode() = ", A.GetCreationMode() -print "A.IsModified() = ", A.IsModified() -print "A.IsLocked() = ", A.IsLocked() +print("A.GetCreationDate() = ", mm,hh,dd,mnth,yy) +print("A.GetCreationMode() = ", A.GetCreationMode()) +print("A.IsModified() = ", A.IsModified()) +print("A.IsLocked() = ", A.IsLocked()) if A.IsLocked() == 0 : - A.SetUserName("tester"); print 'A.SetUserName("tester"), A.GetUserName() = ', A.GetUserName() - A.SetCreationDate(11,11,11,11,2002); print 'A.SetCreationDate(11,11,11,11,2002), A.GetCreationDate() =', A.GetCreationDate() - print "A.IsModified() = ", A.IsModified() + A.SetUserName("tester"); print('A.SetUserName("tester"), A.GetUserName() = ', A.GetUserName()) + A.SetCreationDate(11,11,11,11,2002); print('A.SetCreationDate(11,11,11,11,2002), A.GetCreationDate() =', A.GetCreationDate()) + print("A.IsModified() = ", A.IsModified()) A.SetLocked(1) #check the transaction result batchmode_geompy.myBuilder.CommitCommand() if A.GetUserName() != "tester": - print 'Control after transaction close : A.GetUserName() = ', A.GetUserName() + print('Control after transaction close : A.GetUserName() = ', A.GetUserName()) raise RuntimeError, "Field 'UserName' was not modified but had to!" # try to make some changes wrapped by transaction @@ -63,7 +63,7 @@ if str == None: str = "/tmp" file = str+"/test.hdf" -print " ------- We will save to", file, "-----------" +print(" ------- We will save to", file, "-----------") batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy) @@ -135,17 +135,17 @@ myBuilder.CommitCommand() #4. myBuilder.NewCommand() A.SetLocked(0); -print "A.GetUserName()= ", A.GetUserName() -print "A.GetCreationDate() = ", A.GetCreationDate() -print "A.GetCreationMode() = ", A.GetCreationMode() -print "A.IsModified() = ", A.IsModified() +print("A.GetUserName()= ", A.GetUserName()) +print("A.GetCreationDate() = ", A.GetCreationDate()) +print("A.GetCreationMode() = ", A.GetCreationMode()) +print("A.IsModified() = ", A.IsModified()) myBuilder.CommitCommand() #5. myBuilder.NewCommand() A.SetUserName("tester1") myBuilder.CommitCommand() -print "A.GetUserName()= ", A.GetUserName() +print("A.GetUserName()= ", A.GetUserName()) #remove the document file os.remove(file) diff --git a/doc/salome/examples/example21 b/doc/salome/examples/example21 index 33526d956..6c9dd9783 100644 --- a/doc/salome/examples/example21 +++ b/doc/salome/examples/example21 @@ -29,10 +29,10 @@ a=[836,3425,342] A.SetColumn(3,a) # change attribute values -print "A.GetValue(2,2) = ", A.GetValue(2,2) -print "A.PutValue(2,2,625323)" +print("A.GetValue(2,2) = ", A.GetValue(2,2)) +print("A.PutValue(2,2,625323)") A.PutValue(625323,2,2) -print "A.GetValue(2,2) = ", A.GetValue(2,2) +print("A.GetValue(2,2) = ", A.GetValue(2,2)) #set Titles @@ -48,18 +48,18 @@ A.SetColumnTitle(3,"TC") #check the table -print "Common title : ",A.GetTitle() -print "Rows titles : ", A.GetRowTitles() +print("Common title : ",A.GetTitle()) +print("Rows titles : ", A.GetRowTitles()) rnb = A.GetNbRows() for i in range(1, rnb): b=A.GetRow(i) - print b + print(b) cnb = A.GetNbColumns() -print "Columns title : ", A.GetColumnTitles() +print("Columns title : ", A.GetColumnTitles()) for i in range(1, cnb): b=A.GetColumn(i) - print b + print(b) # set titles #titles=["11","12","13"] @@ -77,7 +77,7 @@ if str == None: str = "/tmp" file = str+"/test.hdf" -print " ------- We will save to", file, "-----------" +print(" ------- We will save to", file, "-----------") batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy) @@ -104,24 +104,24 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeTableOfInteger) #check the table -print "Common title : ",A.GetTitle() -print "Rows titles : ", A.GetRowTitles() +print("Common title : ",A.GetTitle()) +print("Rows titles : ", A.GetRowTitles()) rnb = A.GetNbRows() for i in range(1, rnb): b=A.GetRow(i) - print b + print(b) cnb = A.GetNbColumns() -print "Columns title : ", A.GetColumnTitles() +print("Columns title : ", A.GetColumnTitles()) for i in range(1, cnb): b=A.GetColumn(i) - print b + print(b) titles=["ff","ss","tt"] A.SetRowTitles(titles) -print "Rows titles : ", A.GetRowTitles() +print("Rows titles : ", A.GetRowTitles()) titles=["ww","zz","cc"] A.SetColumnTitles(titles) -print "Column titles : ", A.GetColumnTitles() +print("Column titles : ", A.GetColumnTitles()) diff --git a/doc/salome/examples/example22 b/doc/salome/examples/example22 index bba273be6..84befc2d1 100644 --- a/doc/salome/examples/example22 +++ b/doc/salome/examples/example22 @@ -29,10 +29,10 @@ a=[836,3425,342] A.SetColumn(3,a) # change attribute values -print "A.GetValue(2,2) = ", A.GetValue(2,2) -print "A.PutValue(2,2,625323)" +print("A.GetValue(2,2) = ", A.GetValue(2,2)) +print("A.PutValue(2,2,625323)") A.PutValue(625323,2,2) -print "A.GetValue(2,2) = ", A.GetValue(2,2) +print("A.GetValue(2,2) = ", A.GetValue(2,2)) #set Titles @@ -48,18 +48,18 @@ A.SetColumnTitle(3,"TC") #check the table -print "Common title : ",A.GetTitle() -print "Rows titles : ", A.GetRowTitles() +print("Common title : ",A.GetTitle()) +print("Rows titles : ", A.GetRowTitles()) rnb = A.GetNbRows() + 1 for i in range(1, rnb): b=A.GetRow(i) - print b + print(b) cnb = A.GetNbColumns() + 1 -print "Columns title : ", A.GetColumnTitles() +print("Columns title : ", A.GetColumnTitles()) for i in range(1, cnb): b=A.GetColumn(i) - print b + print(b) # set titles #titles=["11","12","13"] @@ -78,7 +78,7 @@ if str == None: str = "/tmp" file = str+"/test.hdf" -print " ------- We will save to", file, "-----------" +print(" ------- We will save to", file, "-----------") batchmode_geompy.myStudyManager.SaveAs(file, batchmode_geompy.myStudy) @@ -105,24 +105,24 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeTableOfReal) #check the table -print "Common title : ",A.GetTitle() -print "Rows titles : ", A.GetRowTitles() +print("Common title : ",A.GetTitle()) +print("Rows titles : ", A.GetRowTitles()) rnb = A.GetNbRows() + 1 for i in range(1, rnb): b=A.GetRow(i) - print b + print(b) cnb = A.GetNbColumns() + 1 -print "Columns title : ", A.GetColumnTitles() +print("Columns title : ", A.GetColumnTitles()) for i in range(1, cnb): b=A.GetColumn(i) - print b + print(b) titles=["ff","ss","tt"] A.SetRowTitles(titles) -print "Rows titles : ", A.GetRowTitles() +print("Rows titles : ", A.GetRowTitles()) titles=["ww","zz","cc"] A.SetColumnTitles(titles) -print "Column titles : ", A.GetColumnTitles() +print("Column titles : ", A.GetColumnTitles()) diff --git a/doc/salome/examples/example23 b/doc/salome/examples/example23 index da60ce0e9..01763d8a6 100644 --- a/doc/salome/examples/example23 +++ b/doc/salome/examples/example23 @@ -19,7 +19,7 @@ aBuilder.AddDirectory("/User data/Case1") aStudy.SetContext("/User data/Case1") #Print the current study context -print aStudy.GetContext() +print(aStudy.GetContext()) #Add a sub directory 'aSubCase' to 'Case1' (under the current context) aBuilder.AddDirectory("aSubCase") diff --git a/doc/salome/examples/example3 b/doc/salome/examples/example3 index 95e18e8e7..804bf013c 100644 --- a/doc/salome/examples/example3 +++ b/doc/salome/examples/example3 @@ -13,16 +13,16 @@ A.Add(625.1e+2) A.Add(0.928e+100) A.Add(83.287) -print "initial values ",A.Value(1), A.Value(2), A.Value(3), A.Value(4) +print("initial values ",A.Value(1), A.Value(2), A.Value(3), A.Value(4)) A.Remove(3) -print "after remove ", A.Value(1), A.Value(2), A.Value(3) +print("after remove ", A.Value(1), A.Value(2), A.Value(3)) A.ChangeValue(2,76.265) -print "after second item change", A.Value(1), A.Value(2), A.Value(3) +print("after second item change", A.Value(1), A.Value(2), A.Value(3)) if A.Length() != 3: - print "Error : wrong length of SequenceOfReal" + print("Error : wrong length of SequenceOfReal") if A.Value(1) != 0.0293 or A.Value(2) != 76.265 or A.Value(3) != 83.287: - print "Error : wrong value of AttributeSequenceOfReal" + print("Error : wrong value of AttributeSequenceOfReal") # save / restore study #================================= @@ -53,8 +53,8 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeSequenceOfReal) if A.Length() != 3: - print "Error : wrong length of SequenceOfReal" + print("Error : wrong length of SequenceOfReal") if A.Value(1) != 0.0293 or A.Value(2) != 76.265 or A.Value(3) != 83.287: - print "Error : wrong value of AttributeSequenceOfReal" -print "after restoring ", A.Value(1), A.Value(2), A.Value(3) + print("Error : wrong value of AttributeSequenceOfReal") +print("after restoring ", A.Value(1), A.Value(2), A.Value(3)) diff --git a/doc/salome/examples/example4 b/doc/salome/examples/example4 index 2dd1966db..a9694c907 100644 --- a/doc/salome/examples/example4 +++ b/doc/salome/examples/example4 @@ -19,9 +19,9 @@ A.ChangeValue(4,500) if A.Length() != 4: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 700: - print "Wrong value of AttributeSequenceOfInteger" + print("Wrong value of AttributeSequenceOfInteger") # save / restore study @@ -52,7 +52,7 @@ if res == 0 or A == None: A = A._narrow(SALOMEDS.AttributeSequenceOfInteger) if A.Length() != 4: - print "Wrong length of SequenceOfInteger" + print("Wrong length of SequenceOfInteger") if A.Value(1) != 100 or A.Value(2) != 300 or A.Value(3) != 400 or A.Value(4) != 700: - print "Wrong value of AttributeSequenceOfInteger" + print("Wrong value of AttributeSequenceOfInteger") diff --git a/doc/salome/examples/example5 b/doc/salome/examples/example5 index 59e3bc6a0..0f0db484f 100644 --- a/doc/salome/examples/example5 +++ b/doc/salome/examples/example5 @@ -11,7 +11,7 @@ if A == None : A.SetValue("AttributesTesting") if A.Value() != "AttributesTesting": - print "Wrong value of AttributeName" + print("Wrong value of AttributeName") # save / restore study @@ -46,5 +46,5 @@ if A == None : raise RuntimeError, "Can't create AttributeName attribute" if A.Value() != "AttributesTesting": - print "Wrong value of AttributeName" + print("Wrong value of AttributeName") diff --git a/doc/salome/kernel_salome.dox b/doc/salome/kernel_salome.dox index 75deb2960..da63c59e8 100644 --- a/doc/salome/kernel_salome.dox +++ b/doc/salome/kernel_salome.dox @@ -185,7 +185,7 @@ iter = salome.myStudy.NewChildIterator(comp) # initialize from the component iter.InitEx(True) # init recursive mode while iter.More(): c = iter.Value() - print c.GetID() + print(c.GetID()) iter.Next() pass diff --git a/doc/salome/python_doc_compl.dox b/doc/salome/python_doc_compl.dox index 475f8ecff..aee8594cd 100644 --- a/doc/salome/python_doc_compl.dox +++ b/doc/salome/python_doc_compl.dox @@ -120,7 +120,7 @@ def extend_path(pname): # WARN: This may still add duplicate entries to path on # case-insensitive filesystems if os.path.isdir(subdir) and subdir not in __path__: - print "INFO - The directory %s is appended to sys.path" % subdir + print("INFO - The directory %s is appended to sys.path" % subdir) __path__.append(subdir) extend_path(ROOT_PYTHONPACKAGE_NAME) diff --git a/doc/salome/salome_command.dox b/doc/salome/salome_command.dox index bf3c2e6ea..1ec93a046 100644 --- a/doc/salome/salome_command.dox +++ b/doc/salome/salome_command.dox @@ -97,7 +97,7 @@ From a Python script, use a SalomeInstance object: \code from salome_instance import SalomeInstance instance = SalomeInstance.start() -print "Instance created and now running on port", instance.get_port() +print("Instance created and now running on port", instance.get_port()) ... instance.stop() \endcode diff --git a/salome_adm/unix/config_files/check_swig.m4 b/salome_adm/unix/config_files/check_swig.m4 index 8136f11e5..4b61ca056 100644 --- a/salome_adm/unix/config_files/check_swig.m4 +++ b/salome_adm/unix/config_files/check_swig.m4 @@ -58,7 +58,7 @@ EOF AC_MSG_RESULT($swig_ok) fi -numpydir=`$PYTHON -c "import numpy;print numpy.get_include()" 2>/dev/null` +numpydir=`$PYTHON -c "import numpy;print(numpy.get_include())" 2>/dev/null` if test -d "$numpydir"; then numpy_ok=yes PYTHON_INCLUDES="-I$numpydir $PYTHON_INCLUDES" diff --git a/salome_adm/unix/config_files/pyembed.m4 b/salome_adm/unix/config_files/pyembed.m4 index 9f153147a..f40fd0282 100644 --- a/salome_adm/unix/config_files/pyembed.m4 +++ b/salome_adm/unix/config_files/pyembed.m4 @@ -32,7 +32,7 @@ AC_MSG_CHECKING(for flags used to embed python interpreter) changequote(,)dnl py_makefile="`$PYTHON -c ' import sys -print \"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3])'`" +print(\"%s/lib/python%s/config/Makefile\"%(sys.exec_prefix, sys.version[:3]))'`" changequote([,])dnl if test ! -f "$py_makefile"; then AC_MSG_ERROR([*** Couldn't find the python config makefile. Maybe you are @@ -44,11 +44,11 @@ py_lib="`$PYTHON -c ' import sys ver = sys.version[:3] pre = sys.exec_prefix -print \"-L%s/lib/python%s/config\" % (pre, ver), +print(\"-L%s/lib/python%s/config\" % (pre, ver)), if ver == \"1.4\": - print \"-lPython -lObjects -lParser\" + print(\"-lPython -lObjects -lParser\") else: - print \"-lpython\" + ver + print(\"-lpython\" + ver) changequote([,])dnl @@ -83,7 +83,7 @@ AC_MSG_CHECKING(for config.c.in) changequote(,)dnl py_config_in="`$PYTHON -c ' import sys -print \"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3])'`" +print(\"%s/lib/python%s/config/config.c.in\"%(sys.exec_prefix, sys.version[:3]))'`" changequote([,])dnl if test ! -f "$py_config_in"; then AC_MSG_ERROR([*** Couldn't find the config.c.in file. Maybe you are diff --git a/salome_adm/unix/config_files/python.m4 b/salome_adm/unix/config_files/python.m4 index 9153ded5d..fc21aa35b 100644 --- a/salome_adm/unix/config_files/python.m4 +++ b/salome_adm/unix/config_files/python.m4 @@ -59,7 +59,7 @@ AC_DEFUN([CHECK_PYTHON], AC_SUBST(PYTHONHOME) changequote(<<, >>)dnl - PYTHON_VERSION=`$PYTHON -c "import sys; print sys.version[:3]"` + PYTHON_VERSION=`$PYTHON -c "import sys; print(sys.version[:3])"` changequote([, ])dnl AC_SUBST(PYTHON_VERSION) @@ -98,7 +98,7 @@ AC_DEFUN([CHECK_PYTHON], dnl to know which OS Python thinks this is. AC_SUBST(PYTHON_PLATFORM) - PYTHON_PLATFORM=`$PYTHON -c "import sys; print sys.platform"` + PYTHON_PLATFORM=`$PYTHON -c "import sys; print(sys.platform)"` AC_SUBST(PYTHON_SITE) AC_ARG_WITH(python-site, diff --git a/src/KERNEL_PY/batchmode_salome.py b/src/KERNEL_PY/batchmode_salome.py index 06e1ffbae..6cf554390 100755 --- a/src/KERNEL_PY/batchmode_salome.py +++ b/src/KERNEL_PY/batchmode_salome.py @@ -301,5 +301,5 @@ else: myStudyName = myStudy._get_Name() myStudyId = myStudy._get_StudyId() -#print myStudyId +# print(myStudyId) diff --git a/src/KERNEL_PY/kernel/termcolor.py b/src/KERNEL_PY/kernel/termcolor.py index 33476f747..438d98b67 100644 --- a/src/KERNEL_PY/kernel/termcolor.py +++ b/src/KERNEL_PY/kernel/termcolor.py @@ -41,9 +41,9 @@ # import sys # from salome.kernel import termcolor # if termcolor.canDisplayColor(sys.stdout): -# print termcolor.makeColoredMessage("Hello world!", termcolor.BLUE) +# print(termcolor.makeColoredMessage("Hello world!", termcolor.BLUE)) # else: -# print "Hello world!" +# print("Hello world!") # \endcode # \} @@ -65,9 +65,9 @@ Example:: import sys from salome.kernel import termcolor if termcolor.canDisplayColor(sys.stdout): - print termcolor.makeColoredMessage("Hello world!", termcolor.BLUE) + print(termcolor.makeColoredMessage("Hello world!", termcolor.BLUE)) else: - print "Hello world!" + print("Hello world!") """ -- 2.39.2