fixed cleanup routine in neos csdp script
authorPhilipp Meyer
Tue, 01 Sep 2009 11:19:49 +0200
changeset 32542 e37c0ddf257e
parent 32541 cea1716eb106
child 32543 62e6c9b67c6f
fixed cleanup routine in neos csdp script
src/HOL/Library/Sum_Of_Squares/neos_csdp_client
--- a/src/HOL/Library/Sum_Of_Squares/neos_csdp_client	Tue Sep 08 09:57:33 2009 +0200
+++ b/src/HOL/Library/Sum_Of_Squares/neos_csdp_client	Tue Sep 01 11:19:49 2009 +0200
@@ -9,9 +9,10 @@
 NEOS_HOST="neos.mcs.anl.gov"
 NEOS_PORT=3332
 
+neos=xmlrpclib.Server("http://%s:%d" % (NEOS_HOST, NEOS_PORT))
+
 jobNumber = 0
 password = ""
-neos = None
 inputfile = None
 outputfile = None
 # interrupt handler
@@ -34,8 +35,6 @@
   sys.stderr.write("Usage: neos_csdp_client <input_filename> <output_filename>\n")
   sys.exit(19)
 
-neos=xmlrpclib.Server("http://%s:%d" % (NEOS_HOST, NEOS_PORT))
-
 xml_pre = "<document>\n<category>sdp</category>\n<solver>csdp</solver>\n<inputMethod>SPARSE_SDPA</inputMethod>\n<dat><![CDATA["
 xml_post = "]]></dat>\n</document>\n"
 xml = xml_pre
@@ -74,9 +73,9 @@
 if len(result) > 1:
   solution = result[1].strip()
   if solution != "":
-    output = open(sys.argv[2],"w")
-    output.write(solution)
-    output.close()
+    outputfile = open(sys.argv[2],"w")
+    outputfile.write(solution)
+    outputfile.close()
 
 # extract return code
 p = re.compile(r"^Error: Command exited with non-zero status (\d+)$", re.MULTILINE)