mailr11874 - in /branches/bieri_gui: ./ 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:44:
Author: bugman
Date: Fri Dec 17 16:44:45 2010
New Revision: 11874

URL: http://svn.gna.org/viewcvs/relax?rev=11874&view=rev
Log:
Merged revisions 11873 via svnmerge from 
svn+ssh://bugman@xxxxxxxxxxx/svn/relax/1.3

........
  r11873 | bugman | 2010-12-17 16:43:21 +0100 (Fri, 17 Dec 2010) | 6 lines
  
  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:
    branches/bieri_gui/   (props changed)
    branches/bieri_gui/prompt/interpreter.py

Propchange: branches/bieri_gui/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Dec 17 16:44:45 2010
@@ -1,1 +1,1 @@
-/1.3:1-11867
+/1.3:1-11873

Modified: branches/bieri_gui/prompt/interpreter.py
URL: 
http://svn.gna.org/viewcvs/relax/branches/bieri_gui/prompt/interpreter.py?rev=11874&r1=11873&r2=11874&view=diff
==============================================================================
--- branches/bieri_gui/prompt/interpreter.py (original)
+++ branches/bieri_gui/prompt/interpreter.py Fri Dec 17 16:44:45 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