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

Viet Nguyen vhnguyenn at yahoo.com
Fri Sep 12 09:39:22 EDT 2014


On Thursday, September 11, 2014 10:15:57 PM UTC-7, Viet Nguyen wrote:
> 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

Thank you for your help.  That resolved the issue.



More information about the Python-list mailing list