changeset 612:575aa420f866

fix worklist tests for python2
author Alain Mazy <am@osimis.io>
date Thu, 01 Feb 2024 09:41:57 +0100
parents 09fc76fbd46d
children 7a9d5186b51b
files Plugins/Worklists/Run.py
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Worklists/Run.py	Wed Jan 31 13:51:40 2024 +0100
+++ b/Plugins/Worklists/Run.py	Thu Feb 01 09:41:57 2024 +0100
@@ -114,10 +114,16 @@
                                       args.server, str(args.dicom), f.name ],
                                     stderr = subprocess.STDOUT).splitlines()
 
-        a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a))
+        if sys.version_info.major == 2:
+            if len(list(filter(lambda x: x.startswith('E:'), a))) > 0:
+                raise Exception('Error while running findscu')
+        else:
+            # pprint.pprint(a)
+            a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a))
+            # pprint.pprint(a)
 
-        if len(list(filter(lambda x: x.startswith('E:'), a))) > 0:
-            raise Exception('Error while running findscu')
+            if len(list(filter(lambda x: x.startswith('E:'), a))) > 0:
+                raise Exception('Error while running findscu')
 
         b = map(lambda x: x[3:], filter(lambda x: (x.startswith('I: ---') or
                                                    x.startswith('W: ---') or