Author: gnichols
Date: 2010-06-02 00:11:21 +0000 (Wed, 02 Jun 2010)
New Revision: 519
Modified:
trunk/v7/documentbase.py
Log:
598544 - Control-C interrupt of v7 often results in broken results.xml
Modified: trunk/v7/documentbase.py
===================================================================
--- trunk/v7/documentbase.py 2010-05-28 14:30:09 UTC (rev 518)
+++ trunk/v7/documentbase.py 2010-06-02 00:11:21 UTC (rev 519)
@@ -14,7 +14,7 @@
#
# Author: Greg Nichols
#
-import string
+import string, sys
import time, datetime
from xml.dom.minidom import getDOMImplementation, parse
import xml.dom.ext
@@ -228,8 +228,17 @@
def save(self, filename):
file = open(filename, "w")
- xml.dom.ext.PrettyPrint(self.document, file)
- file.close()
+ try:
+ xml.dom.ext.PrettyPrint(self.document, file)
+ except KeyboardInterrupt, interrupt:
+ print "\nExiting - please wait while data is saved..."
+ file.close()
+ file = open(filename, "w")
+ xml.dom.ext.PrettyPrint(self.document, file)
+ file.close()
+ sys.exit(1)
+ finally:
+ file.close()
Show replies by date