# HG changeset patch # User catherine@dellzilla # Date 1237917540 14400 # Node ID 035330ccfcf0df2c6d7e7f063ee93ba69e6c1da0 # Parent 78ad20c2eed0ab10455f4bf28d77a2901d5ab280 py really working right now diff -r 78ad20c2eed0 -r 035330ccfcf0 cmd2.py --- a/cmd2.py Tue Mar 24 13:48:25 2009 -0400 +++ b/cmd2.py Tue Mar 24 13:59:00 2009 -0400 @@ -792,8 +792,7 @@ def do_py(self, arg): ''' py : Executes a Python command. - py: Enters interactive Python mode; end with `Ctrl-D`. - Do not end with Ctrl-Z, or it will end your entire cmd2 session! + py: Enters interactive Python mode; end with `Ctrl-D`, `quit()`, or 'exit`. Non-python commands can be issued with cmd('your non-python command here'). ''' if arg.strip(): @@ -803,9 +802,11 @@ interp = MyInteractiveConsole(locals=self.pystate) def quit(): raise EmbeddedConsoleExit + def onecmd(arg): + return self.onecmd(arg + '\n') self.pystate['quit'] = quit self.pystate['exit'] = quit - self.pystate[self.nonpythoncommand] = self.onecmd + self.pystate[self.nonpythoncommand] = onecmd try: interp.interact() except SystemExit: