mailr11873 - /1.3/prompt/interpreter.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on December 17, 2010 - 16:43:
Author: bugman
Date: Fri Dec 17 16:43:21 2010
New Revision: 11873

URL: http://svn.gna.org/viewcvs/relax?rev=11873&view=rev
Log:
Fix for script execution - the original state is restored if an exception 
occurs.

The original working directory is restored and the script path is removed in 
all cases by using a
try-finally setup.


Modified:
    1.3/prompt/interpreter.py

Modified: 1.3/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/1.3/prompt/interpreter.py?rev=11873&r1=11872&r2=11873&view=diff
==============================================================================
--- 1.3/prompt/interpreter.py (original)
+++ 1.3/prompt/interpreter.py Fri Dec 17 16:43:21 2010
@@ -366,14 +366,15 @@
         raise RelaxError("The relax script must not contain the '.' 
character (except before the extension '*.py').")
 
     # Execute the module.
-    runpy.run_module(module, globals)
-
-    # Switch back to the original working directory.
-    if head:
-        chdir(orig_dir)
-
-    # Remove the script path.
-    sys.path.pop(sys.path.index(script_path))
+    try:
+        runpy.run_module(module, globals)
+    finally:
+        # Switch back to the original working directory.
+        if head:
+            chdir(orig_dir)
+
+        # Remove the script path.
+        sys.path.pop(sys.path.index(script_path))
 
     # Unlock execution if needed.
     status.exec_lock.release()




Related Messages


Powered by MHonArc, Updated Fri Dec 17 17:00:02 2010