diff options
author | catherine <catherine@Elli.myhome.westell.com> | 2009-03-18 22:02:15 -0400 |
---|---|---|
committer | catherine <catherine@Elli.myhome.westell.com> | 2009-03-18 22:02:15 -0400 |
commit | a4ac0e07c3a36baa753ef831530b2c1bdf24096c (patch) | |
tree | 47c334a9ce1c3ac95dd59ba1c92d532c6b048a61 | |
parent | 43824eb0e7be9561802717a7c08f3e0653fa7836 (diff) | |
download | cmd2-hg-0.4.8.tar.gz |
autobind test failing0.4.8
-rwxr-xr-x | cmd2.py | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -744,21 +744,23 @@ class Cmd(cmd.Cmd): def do_py(self, arg):
'''
py <command>: 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:
|