Author: bugman Date: Fri Dec 17 16:47:44 2010 New Revision: 11877 URL: http://svn.gna.org/viewcvs/relax?rev=11877&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/multi_processor_merge/ (props changed) branches/multi_processor_merge/prompt/interpreter.py Propchange: branches/multi_processor_merge/ ------------------------------------------------------------------------------ --- svnmerge-integrated (original) +++ svnmerge-integrated Fri Dec 17 16:47:44 2010 @@ -1,1 +1,1 @@ -/1.3:1-11870 +/1.3:1-11876 Modified: branches/multi_processor_merge/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/branches/multi_processor_merge/prompt/interpreter.py?rev=11877&r1=11876&r2=11877&view=diff ============================================================================== --- branches/multi_processor_merge/prompt/interpreter.py (original) +++ branches/multi_processor_merge/prompt/interpreter.py Fri Dec 17 16:47:44 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()