Browse Source

Fixed even more parts

Yentl Van Tendeloo 8 years ago
parent
commit
790538dae2

+ 1 - 4
integration/utils.py

@@ -146,10 +146,7 @@ def run_file(files, parameters, expected, mode):
         for e in expected:
             c = len(e) if isinstance(e, set) else 1
             for _ in range(c):
-                if got_output:
-                    val = got_output.pop(0)
-                else:
-                    val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=240).read()
+                val = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username})), timeout=240).read()
 
                 if proc.returncode is not None:
                     # Modelverse has already terminated, which isn't a good sign!

+ 1 - 1
interface/HUTN/hutn_compiler/constructors_object_visitor.py

@@ -78,7 +78,7 @@ class ConstructorsObjectVisitor(ConstructorsVisitor):
         # Wait for kernel to signal that it finished
         urllib2.urlopen(urllib2.Request(self.address, urllib.urlencode({"op": "set_input", "value": '2', "username": self.username}))).read()
         v = urllib2.urlopen(urllib2.Request(self.address, urllib.urlencode({"op": "get_output", "username": self.username}))).read()
-        v = v.split("=", 2)[2]
+        v = json.loads(v)
         if v == "DONE":
             return True
         else:

+ 1 - 0
interface/HUTN/hutn_compiler/linker.py

@@ -25,6 +25,7 @@ def link(address, username, objects):
 
     data = flush_data(address, data, username)
     v = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username}))).read()
+    v = json.loads(v)
     if "OK" not in v:
         print(v)
         raise Exception("Linking error")

+ 1 - 1
scripts/execute_model.py

@@ -39,7 +39,7 @@ def initialize_SCD():
 
     print("Initializing SCD")
     urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "set_input", "data": json.dumps(data), "username": username}))).read()
-    v = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username}))).read()
+    urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username}))).read()
     print("Initialized!")
 
 for f in models:

+ 1 - 1
scripts/prompt.py

@@ -51,7 +51,7 @@ local_print("To quit: execute command 'quit'")
 def print_output():
     while 1:
         output = urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "username": username}))).read()
-        remote_print("%s" % str(output))
+        remote_print("%s" % str(json.loads(output)))
 
 thrd = threading.Thread(target=print_output)
 thrd.daemon = True