changeset 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 ba06331ac8dd
children ec657d1a62a6
files Plugins/Worklists/Run.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Plugins/Worklists/Run.py	Wed Jan 24 13:23:29 2024 +0100
+++ b/Plugins/Worklists/Run.py	Wed Jan 31 11:36:37 2024 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 # -*- coding: utf-8 -*-
 
 
@@ -114,7 +114,9 @@
                                       args.server, str(args.dicom), f.name ],
                                     stderr = subprocess.STDOUT).splitlines()
 
-        if len(filter(lambda x: x.startswith('E:'), a)) > 0:
+        a = list(map(lambda x: x.decode('utf-8', errors="ignore"), a))
+
+        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
@@ -294,7 +296,7 @@
 
         AddToDatabase('Encodings/database.dump')
 
-        for name, encoding in ENCODINGS.iteritems():
+        for (name, encoding) in ENCODINGS.items():
             self.assertEqual(name, DoPut(ORTHANC, '/tools/default-encoding', name))
             result = RunQuery('Encodings/query.dump', [])