# HG changeset patch # User catherine@Elli.myhome.westell.com # Date 1237428135 14400 # Node ID 9aa1f34455b49c9e47f86ef1b8caa2d8cef45248 # Parent 8c277a37e2bc6000118d21430950dbf7e8c9e1a4 autobind test failing diff -r 8c277a37e2bc -r 9aa1f34455b4 cmd2.py --- a/cmd2.py Wed Mar 18 18:27:29 2009 -0400 +++ b/cmd2.py Wed Mar 18 22:02:15 2009 -0400 @@ -744,21 +744,23 @@ def do_py(self, arg): ''' py : Executes a Python command. - py: Enters interactive Python mode (end with `\py`). + py: Enters interactive Python mode (end with `end py`). ''' if arg.strip(): try: result = eval(arg, self.pystate) - if result is None: + print repr(result) + except SyntaxError: + try: exec(arg, self.pystate) - else: - print result + except Exception: + raise except Exception, e: print e else: - print 'Now accepting python commands; end with `\\py`' + print 'Now accepting python commands; end with `end py`' buffer = [self.pseudo_raw_input('>>> ')] - while not buffer[-1].strip().startswith('\\py'): + while buffer[-1].lower().split()[:2] != ['end','py']: try: buf = '\n'.join(buffer) try: