diff Resources/SyncOrthancFolder.py @ 49:c71a008fc1e3

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 22 Nov 2023 07:59:30 +0100
parents 92b93845d84b
children
line wrap: on
line diff
--- a/Resources/SyncOrthancFolder.py	Mon Aug 14 10:26:33 2023 +0200
+++ b/Resources/SyncOrthancFolder.py	Wed Nov 22 07:59:30 2023 +0100
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 #
 # This maintenance script updates the content of the "Orthanc" folder
@@ -8,11 +8,11 @@
 import multiprocessing
 import os
 import stat
-import urllib2
+import urllib.request
 
 TARGET = os.path.join(os.path.dirname(__file__), 'Orthanc')
 PLUGIN_SDK_VERSION = '1.0.0'
-REPOSITORY = 'https://hg.orthanc-server.com/orthanc/raw-file'
+REPOSITORY = 'https://orthanc.uclouvain.be/hg/orthanc/raw-file'
 
 FILES = [
     ('OrthancFramework/Resources/CMake/AutoGeneratedCode.cmake', 'CMake'),
@@ -47,8 +47,12 @@
 
     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:
+        try:
+            f.write(urllib.request.urlopen(url).read())
+        except:
+            print('ERROR: %s' % url)
+            raise
 
 
 commands = []