changeset 4665:43f13842bc3b

fix AutoClassify.py sample for compatibility with Python 3.x
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 20 May 2021 09:29:25 +0200
parents f9eda86f9045
children 3294385a245a
files OrthancServer/Resources/Samples/Python/AutoClassify.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Resources/Samples/Python/AutoClassify.py	Fri May 14 11:46:57 2021 +0200
+++ b/OrthancServer/Resources/Samples/Python/AutoClassify.py	Thu May 20 09:29:25 2021 +0200
@@ -46,7 +46,12 @@
 
 
 def FixPath(p):
-    return p.encode('ascii', errors = 'replace').translate(None, r"'\/:*?\"<>|!=").strip()
+    s = p.encode('ascii', errors = 'replace').decode('ascii')
+    
+    for c in "'\/:*?\"<>|!=":
+        s = s.replace(c, '')
+
+    return s.strip()
 
 def GetTag(resource, tag):
     if ('MainDicomTags' in resource and