Author: bugman Date: Fri Sep 28 18:32:10 2012 New Revision: 17609 URL: http://svn.gna.org/viewcvs/relax?rev=17609&view=rev Log: Python 3 preparations - converted the relax prompt/script interpreter to be Python 2 and 3 compatible. Modified: trunk/prompt/interpreter.py Modified: trunk/prompt/interpreter.py URL: http://svn.gna.org/viewcvs/relax/trunk/prompt/interpreter.py?rev=17609&r1=17608&r2=17609&view=diff ============================================================================== --- trunk/prompt/interpreter.py (original) +++ trunk/prompt/interpreter.py Fri Sep 28 18:32:10 2012 @@ -27,7 +27,7 @@ # Python module imports. import ansi -from code import InteractiveConsole, softspace +from code import InteractiveConsole from math import pi from os import F_OK, access, chdir, getcwd, path from pydoc import pager @@ -431,10 +431,11 @@ if show_script: try: file = open(script_file, 'r') - except IOError, warning: + except IOError: try: raise RelaxError("The script file '" + script_file + "' does not exist.") - except AllRelaxErrors, instance: + except AllRelaxErrors: + instance = sys.exc_info()[1] sys.stdout.write(instance.__str__()) sys.stdout.write("\n") return @@ -483,7 +484,9 @@ exec_pass = False # Catch the RelaxErrors. - except AllRelaxErrors, instance: + except AllRelaxErrors: + instance = sys.exc_info()[1] + # Unlock execution. status.exec_lock.release() @@ -593,11 +596,9 @@ exec(code, self.locals) except SystemExit: raise - except AllRelaxErrors, instance: + except AllRelaxErrors: + instance = sys.exc_info()[1] self.write(instance.__str__()) self.write("\n") except: self.showtraceback() - else: - if softspace(sys.stdout, 0): - print('')