Mercurial > hg > orthanc
diff OrthancServer/Resources/Samples/Python/AutoClassify.py @ 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 | d9473bd5ed43 |
children | 7053502fbf97 |
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