redirecting stdout from NT

Johannes Stezenbach yawyi at gmx.de
Tue Mar 7 18:19:00 EST 2000


Michael O'Brien <mobrien at pixar.com> wrote:
>In a complex python script, I have:
>
>    print "hiya"
...
>Trying to pipe this thru more I get:
>
>    E:\users\mobrien\test>t001.py | more
>
>    E:\users\mobrien\test>

This a known bug of the NT command interpreter (or the ShellExecute()
system function, to be more specific). Either invoke Python directly
  python t001.py | more
or build a .bat which calls "python t001.py" and call that or (NT only,
not W9x compatible) rename your .py to .cmd and put this in the first
line:
  @python -x "%~f0" %* & goto :eof

Johannes

PS: Try "set /?" (or maybe "call /?", can't remember now) to get help
understanding "%~f0".




More information about the Python-list mailing list