Mercurial > hg > orthanc-stone
changeset 2004:6a96a1920fd8
fix
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 02 Nov 2022 15:29:01 +0100 |
parents | 1bb0a9716876 |
children | cd5a998596f1 862c572021de |
files | OrthancStone/Resources/SyncOrthancFolder.py RenderingPlugin/Resources/SyncOrthancFolder.py |
diffstat | 2 files changed, 11 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/OrthancStone/Resources/SyncOrthancFolder.py Wed Nov 02 15:07:06 2022 +0100 +++ b/OrthancStone/Resources/SyncOrthancFolder.py Wed Nov 02 15:29:01 2022 +0100 @@ -32,7 +32,7 @@ import sys if sys.version_info[0] < 3: - from urllib import urlopen + from urllib2 import urlopen else: from urllib.request import urlopen
--- a/RenderingPlugin/Resources/SyncOrthancFolder.py Wed Nov 02 15:07:06 2022 +0100 +++ b/RenderingPlugin/Resources/SyncOrthancFolder.py Wed Nov 02 15:29:01 2022 +0100 @@ -28,7 +28,13 @@ import multiprocessing import os import stat -import urllib2 +import sys + +if sys.version_info[0] < 3: + from urllib2 import urlopen +else: + from urllib.request import urlopen + TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc') PLUGIN_SDK_VERSION = '1.0.0' @@ -52,7 +58,7 @@ branch = x[0] source = x[1] target = os.path.join(TARGET, x[2]) - print target + print(target) try: os.makedirs(os.path.dirname(target)) @@ -61,8 +67,8 @@ url = '%s/%s/%s' % (REPOSITORY, branch, source) - with open(target, 'w') as f: - f.write(urllib2.urlopen(url).read()) + with open(target, 'wb') as f: + f.write(urlopen(url).read()) commands = []