[python-win32] Capturing stdout when running a Python Script

Stefan Holmgren stefan.holmgren at accalon.se
Fri Oct 27 10:06:07 CEST 2006


You can add this after your script "> file.txt"

Example:

<prompt>:you_script.py >korv.txt

Then it will your print to the korv file..



/HejHopp

"Johan Lindvall" <johan.lindvall at gmail.com> wrote in message 
news:bab5abcd0610270048p487885cfh3ad5ed21c68c2af3 at mail.gmail.com...
> Hi,
>
> Is there any way of capturing or displaying stdout when running a
> Python script? I know about:
>
> import sys
> sys.stdout = open("logfile.txt", "a")
>
> but I don't want to modify my scripts to achieve this.
>
> -- 
> /Johan. 





More information about the Python-win32 mailing list