# HG changeset patch # User catherine@Drou # Date 1266341027 18000 # Node ID 6c397f0865c79b1b96225551ffeffd7762000c27 # Parent 92a15405ed8a06bc42df29375d079d2c5487125a MyInteractiveInterpreter removed diff -r 92a15405ed8a -r 6c397f0865c7 cmd2.py --- a/cmd2.py Tue Feb 16 11:22:45 2010 -0500 +++ b/cmd2.py Tue Feb 16 12:23:47 2010 -0500 @@ -38,7 +38,7 @@ import traceback import platform import copy -from code import InteractiveConsole, InteractiveInterpreter, softspace +from code import InteractiveConsole, InteractiveInterpreter from optparse import make_option if sys.version_info[0] > 2: @@ -350,31 +350,6 @@ class EmbeddedConsoleExit(Exception): pass -class MyInteractiveConsole(InteractiveConsole): - def runcode(self, code): - """Execute a code object. - - When an exception occurs, self.showtraceback() is called to - display a traceback. All exceptions are caught except - SystemExit, which is reraised. - - A note about KeyboardInterrupt: this exception may occur - elsewhere in this code, and may not always be caught. The - caller should be prepared to deal with it. - - Copied directly from code.InteractiveInterpreter, except for - EmbeddedConsoleExit exceptions. - """ - try: - exec code in self.locals - except (SystemExit, EmbeddedConsoleExit): - raise - except: - self.showtraceback() - else: - if softspace(sys.stdout, 0): - print () - def ljust(x, width, fillchar=' '): 'analogous to str.ljust, but works for lists' if hasattr(x, 'ljust'): @@ -403,7 +378,7 @@ feedback_to_output = False # Do include nonessentials in >, | output quiet = False # Do not suppress nonessential output debug = False - locals_in_py = False + locals_in_py = True settable = stubbornDict(''' prompt colors Colorized output (*nix only) @@ -1045,9 +1020,8 @@ interp.runcode(arg) else: localvars = (self.locals_in_py and self.pystate) or {} - interp = MyInteractiveConsole(locals=localvars) + interp = InteractiveConsole(locals=localvars) def quit(): - 'blah' raise EmbeddedConsoleExit def onecmd(arg): return self.onecmd(arg + '\n')