소스 검색

Adding networkConfig flag to setup will use other server as the one specified in network.json. File named in networkConfig should exist in .labkey directory of the user executing the script

NIX User 2 년 전
부모
커밋
f13644aaa3
1개의 변경된 파일14개의 추가작업 그리고 3개의 파일을 삭제
  1. 14 3
      pythonScripts/scanOrthancQuick.py

+ 14 - 3
pythonScripts/scanOrthancQuick.py

@@ -24,6 +24,9 @@ def main(parameterFile):
     with open(fsetup,'r') as f:
         setup=json.load(f)
 
+    with open(parameterFile) as f:
+        pars=json.load(f)
+
     sys.path.insert(0,setup['paths']['nixWrapper'])
     import nixWrapper
 
@@ -35,7 +38,17 @@ def main(parameterFile):
     import orthancInterface
     import orthancDatabaseBrowser
 
-    fconfig=os.path.join(fhome,'.labkey','network.json')
+    try:
+        networkSetup=pars['networkSetup']
+    except KeyError:
+        networkSetup='network.json'
+
+    fconfig=os.path.join(fhome,'.labkey',networkSetup)
+    
+    if not os.path.isfile(fconfig):
+        print('Failed to find network configuration {}'.format(fconfig))
+        return
+
 
     net=labkeyInterface.labkeyInterface()
     net.init(fconfig)
@@ -47,8 +60,6 @@ def main(parameterFile):
     odb=orthancDatabaseBrowser.orthancDB(onet)
 
 
-    with open(parameterFile) as f:
-        pars=json.load(f)
 
     opars=pars['Orthanc']
     project=opars['project']