diff cmd2.py @ 29:a6f68b25ae16

load is perfect
author devlinjs@FA7CZA6N1254998.wrightpatterson.afmc.ds.af.mil
date Fri, 21 Dec 2007 10:04:26 -0500
parents ca6f34be3397
children 2739250177ed
line wrap: on
line diff
--- a/cmd2.py	Thu Dec 20 13:48:56 2007 -0500
+++ b/cmd2.py	Fri Dec 21 10:04:26 2007 -0500
@@ -231,15 +231,16 @@
         except IOError, e:
             try:
                 self.stdin = open('%s.%s' % (fname, self.defaultExtension), 'r')
-		self.use_rawinput = False
-		self.prompt = self.continuationPrompt = ''
-		self.cmdloop()
-		self.stdin.close()
-		self.lastcmd = ''		
-            except IOError:
+	    except IOError:
                 print 'Problem opening file %s: \n%s' % (fname, e)
-        finally:	
-	    keepstate.restore()
+		keepstate.restore()
+		return
+	self.use_rawinput = False
+	self.prompt = self.continuationPrompt = ''
+	self.cmdloop()
+	self.stdin.close()
+	keepstate.restore()
+	self.lastcmd = ''
 	    
 class HistoryItem(str):
     def __init__(self, instr):