Mercurial > hg > orthanc-tests
comparison Plugins/Worklists/Run.py @ 609:a8e49d30f634
compatibility of Plugins/Worklists/Run.py with python 3
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 31 Jan 2024 11:36:37 +0100 |
parents | 6546ca088276 |
children | 575aa420f866 |
comparison
equal
deleted
inserted
replaced
608:ba06331ac8dd | 609:a8e49d30f634 |
---|---|
1 #!/usr/bin/python | 1 #!/usr/bin/python3 |
2 # -*- coding: utf-8 -*- | 2 # -*- coding: utf-8 -*- |
3 | 3 |
4 | 4 |
5 # Orthanc - A Lightweight, RESTful DICOM Store | 5 # Orthanc - A Lightweight, RESTful DICOM Store |
6 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics | 6 # Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics |
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 if len(filter(lambda x: x.startswith('E:'), a)) > 0: | 117 a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a)) |
118 | |
119 if len(list(filter(lambda x: x.startswith('E:'), a))) > 0: | |
118 raise Exception('Error while running findscu') | 120 raise Exception('Error while running findscu') |
119 | 121 |
120 b = map(lambda x: x[3:], filter(lambda x: (x.startswith('I: ---') or | 122 b = map(lambda x: x[3:], filter(lambda x: (x.startswith('I: ---') or |
121 x.startswith('W: ---') or | 123 x.startswith('W: ---') or |
122 x.startswith('I: (') or | 124 x.startswith('I: (') or |
292 'Utf8' : [ 'ISO_IR 192' ], | 294 'Utf8' : [ 'ISO_IR 192' ], |
293 } | 295 } |
294 | 296 |
295 AddToDatabase('Encodings/database.dump') | 297 AddToDatabase('Encodings/database.dump') |
296 | 298 |
297 for name, encoding in ENCODINGS.iteritems(): | 299 for (name, encoding) in ENCODINGS.items(): |
298 self.assertEqual(name, DoPut(ORTHANC, '/tools/default-encoding', name)) | 300 self.assertEqual(name, DoPut(ORTHANC, '/tools/default-encoding', name)) |
299 result = RunQuery('Encodings/query.dump', []) | 301 result = RunQuery('Encodings/query.dump', []) |
300 | 302 |
301 self.assertEqual(1, len(result)) | 303 self.assertEqual(1, len(result)) |
302 self.assertEqual(2, len(result[0])) | 304 self.assertEqual(2, len(result[0])) |