diff Resources/Samples/Python/AutoClassify.py @ 1184:4e9d517503ae

port to Python3
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 10 Oct 2014 09:13:48 +0200
parents 6ef2c81581cd
children 6e7e5ed91c2d
line wrap: on
line diff
--- a/Resources/Samples/Python/AutoClassify.py	Fri Oct 10 08:52:56 2014 +0200
+++ b/Resources/Samples/Python/AutoClassify.py	Fri Oct 10 09:13:48 2014 +0200
@@ -23,6 +23,7 @@
 import time
 import os
 import os.path
+import sys
 import RestToolbox
 
 parser = argparse.ArgumentParser(
@@ -44,7 +45,7 @@
 
 
 def FixPath(p):
-    return p.encode('ascii', 'ignore').strip()
+    return p.encode('ascii', 'ignore').strip().decode()
 
 def GetTag(resource, tag):
     if ('MainDicomTags' in resource and
@@ -70,7 +71,7 @@
     
     p = os.path.join(args.target, FixPath(a), FixPath(b), FixPath(c))
     f = os.path.join(p, FixPath(d))
-                             
+
     # Copy the DICOM file to the target path
     print('Writing new DICOM file: %s' % f)