# HG changeset patch # User Sebastien Jodogne # Date 1680857284 -7200 # Node ID a06d0a45c62f71b2cfba264a66217ab8c82abb85 # Parent b1991073e4d17c966c08b6c474caa56171e52475 Python 3 compatibility of GenerateConfigurationForTests.py diff -r b1991073e4d1 -r a06d0a45c62f GenerateConfigurationForTests.py --- a/GenerateConfigurationForTests.py Thu Apr 06 17:01:27 2023 +0200 +++ b/GenerateConfigurationForTests.py Fri Apr 07 10:48:04 2023 +0200 @@ -27,7 +27,12 @@ import subprocess import sys import json -import urllib +import sys + +if sys.version_info[0] < 3: + from urllib2 import urlopen +else: + from urllib.request import urlopen ## @@ -85,11 +90,11 @@ # Download the content of the default configuration file -with open(args.target, 'w') as f: +with open(args.target, 'wb') as f: url = 'https://hg.orthanc-server.com/orthanc/raw-file/default/OrthancServer/Resources/Configuration.json' #url = 'https://hg.orthanc-server.com/orthanc/raw-file/default/Resources/Configuration.json' #url = 'https://bitbucket.org/sjodogne/orthanc/raw/default/Resources/Configuration.json' - http = urllib.urlopen(url) + http = urlopen(url) if http.getcode() != 200: raise Exception('Cannot download: %s' % url)