comparison Plugins/Worklists/Run.py @ 612:575aa420f866

fix worklist tests for python2
author Alain Mazy <am@osimis.io>
date Thu, 01 Feb 2024 09:41:57 +0100
parents a8e49d30f634
children 88539de02bcc
comparison
equal deleted inserted replaced
611:09fc76fbd46d 612:575aa420f866
112 112
113 a = subprocess.check_output([ 'findscu', '-v', '--call', 'ORTHANC', '-aet', 'ORTHANCTEST', 113 a = subprocess.check_output([ 'findscu', '-v', '--call', 'ORTHANC', '-aet', 'ORTHANCTEST',
114 args.server, str(args.dicom), f.name ], 114 args.server, str(args.dicom), f.name ],
115 stderr = subprocess.STDOUT).splitlines() 115 stderr = subprocess.STDOUT).splitlines()
116 116
117 a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a)) 117 if sys.version_info.major == 2:
118 118 if len(list(filter(lambda x: x.startswith('E:'), a))) > 0:
119 if len(list(filter(lambda x: x.startswith('E:'), a))) > 0: 119 raise Exception('Error while running findscu')
120 raise Exception('Error while running findscu') 120 else:
121 # pprint.pprint(a)
122 a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a))
123 # pprint.pprint(a)
124
125 if len(list(filter(lambda x: x.startswith('E:'), a))) > 0:
126 raise Exception('Error while running findscu')
121 127
122 b = map(lambda x: x[3:], filter(lambda x: (x.startswith('I: ---') or 128 b = map(lambda x: x[3:], filter(lambda x: (x.startswith('I: ---') or
123 x.startswith('W: ---') or 129 x.startswith('W: ---') or
124 x.startswith('I: (') or 130 x.startswith('I: (') or
125 x.startswith('W: (')), a)) 131 x.startswith('W: (')), a))