output of shell command
Mark Hadfield
m.hadfield at niwa.cri.nz
Mon Feb 26 20:38:46 EST 2001
"Steve Holden" <sholden at holdenweb.com> wrote in message
news:UYAm6.21417$P87.223264 at e420r-atl2.usenetserver.com...
> Note, however, that under PythonWin:
>
> >>> import os
> >>> a=os.popen("dir").readlines()
> Traceback (innermost last):
> File "<interactive input>", line 1, in ?
> WindowsError: [Errno 2] The system cannot find the file specified
I found, as you did that, this works only in console Python (using Python
2.0 + win32all-137 on Windows 2000). However the following
a=(os.popen("dir")).readlines()
works (returns a string array) in both console Python and PythonWin .
> Not sure why it works with a vanilla interpreter but not in PythonWin.
A subtle difference in operator precedence?
---
Mark Hadfield
m.hadfield at niwa.cri.nz http://katipo.niwa.cri.nz/~hadfield
National Institute for Water and Atmospheric Research
More information about the Python-list
mailing list