Salome HOME
bos #24412 Add missing failback for UpdateView() method
[modules/kernel.git] / src / KERNEL_PY / kernel / syshelper.py
index f3c94600df0d86459942b9a2b51d59e858d45e8b..9e2faa374594156a2677c96e571b0a9958a96aa5 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: iso-8859-1 -*-
-# Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -58,7 +58,7 @@ def walktree(rootpath, callback, **kwargs):
         pathname = os.path.join(rootpath, f)
         try:
             mode = os.stat(pathname)[ST_MODE]
-        except OSError, e:
+        except OSError as e:
             # It probably means that the file is a broken inode
             mode = -1
         if S_ISDIR(mode):
@@ -69,7 +69,7 @@ def walktree(rootpath, callback, **kwargs):
             callback(pathname, **kwargs)
         else:
             # Unknown file type, print a message
-            print 'Skipping %s' % pathname
+            print('Skipping %s' % pathname)
 
 
 #
@@ -84,26 +84,26 @@ except KeyError:
     TESTDOCDIR="/tmp"
     
 def TEST_findFiles():
-    print "########## find 1"
+    print("########## find 1")
     rootpath=TESTDOCDIR
     listfiles=findFiles(rootpath)
     for filename in listfiles:
-        print filename
+        print(filename)
 
-    print "########## find 2"
+    print("########## find 2")
     excludes=[os.path.join(TESTDOCDIR,"doc")]
     listfiles=findFiles(rootpath,excludes)
     for filename in listfiles:
-        print filename
+        print(filename)
 
     return True
 
 # This is the test callback function
 def visitfile_withargs(file, rootid):
-    print 'visiting file %s (rootid=%s)'%(file,str(rootid))
+    print('visiting file %s (rootid=%s)'%(file,str(rootid)))
 
 def visitfile_withoutargs(file):
-    print 'visiting file %s'%(file)
+    print('visiting file %s'%(file))
 
 def TEST_walktree():
     #walktree(TESTDOCDIR, visitfile_withargs, rootid=2)
@@ -111,6 +111,6 @@ def TEST_walktree():
     return True
 
 if __name__ == "__main__":
-    import unittester
+    from . import unittester
     unittester.run("syshelper", "TEST_findFiles")
     unittester.run("syshelper", "TEST_walktree")