diff Resources/Samples/Python/AutoClassify.py @ 2070:7e6afa0beaf6

samples: improved handling of special characters in paths
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 14 Jul 2016 09:05:22 +0200
parents 65b1ce7cb84f
children bec08e9236f5
line wrap: on
line diff
--- a/Resources/Samples/Python/AutoClassify.py	Wed Jul 13 16:52:39 2016 +0200
+++ b/Resources/Samples/Python/AutoClassify.py	Thu Jul 14 09:05:22 2016 +0200
@@ -45,7 +45,7 @@
 
 
 def FixPath(p):
-    return p.encode('ascii', 'ignore').strip().decode()
+    return p.encode('ascii', errors = 'replace').translate(None, r"'\/:*?\"<>|!=").strip()
 
 def GetTag(resource, tag):
     if ('MainDicomTags' in resource and