Browse Source

Catch exceptions during close

Yentl Van Tendeloo 8 years ago
parent
commit
b92d74df40
1 changed files with 5 additions and 2 deletions
  1. 5 2
      wrappers/modelverse.py

+ 5 - 2
wrappers/modelverse.py

@@ -73,8 +73,11 @@ def _output_thread(outputs):
     while taskname is None:
         time.sleep(0.1)
 
-    while 1:
-        outputs.append(json.loads(urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "taskname": taskname}))).read()))
+    try:
+        while 1:
+            outputs.append(json.loads(urllib2.urlopen(urllib2.Request(address, urllib.urlencode({"op": "get_output", "taskname": taskname}))).read()))
+    except:
+        pass
 
 thrd = threading.Thread(target=_output_thread, args=[outputs])
 thrd.daemon = True