Why command os.popen works in python interactive mode but not in script debugger mode?

Viet Nguyen vhnguyenn at yahoo.com
Fri Sep 12 07:15:31 CEST 2014


Can anyone give me hint or reason why same command behaves differently in debugger mode from interactive mode:

>From interactive mode:

>>> import os
>>> p = os.popen('date')
>>> p.read()
'Thu Sep 11 11:18:07 PDT 2014\n'

But from debugger mode in a script:
>>> import os
(Pdb) p = os.popen('date')
*** SyntaxError: SyntaxError('invalid syntax', ('<string>', 1, 1, "= os.popen('date')"))


Can anyone help me why there is syntax here?

Thanks,
Viet






More information about the Python-list mailing list