Why command os.popen works in python interactive mode but not in script debugger mode?
rosuav at gmail.com
Fri Sep 12 07:26:04 CEST 2014
On Fri, Sep 12, 2014 at 3:15 PM, Viet Nguyen
<vhnguyenn at yahoo.com.dmarc.invalid> wrote:
> 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?
This is actually a command to the debugger. You say "p
some_expression" and it prints out the value of some_expression.
Commands that the debugger doesn’t recognize are assumed to be Python
statements and are executed in the context of the program being
debugged. Python statements can also be prefixed with an exclamation
So try this:
!p = os.popen('date')
More information about the Python-list