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

2006-10-29 Thread Johan Lindvall
I managed to solve this by setting the Std Handles (SetStdHandle) and reopening stderr and s tdout of the Python CRT (vc 71) Our app is built with VC 8, so I had to use a Dll built with VC 7.1 to accomplish this (with LoadLibrary and GetProcAddress. Code references: http://msdn.microsoft.com/libr

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

2006-10-29 Thread Mark Hammond
> I am afraid my orginal post was a bit unclear. I am looking for a way > to capture script output running in an ActiveScript Python host. I'm afraid that is not possible - some script code will need to perform that redirection for you, and that might need to happen for each script - the axscript

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

2006-10-27 Thread Michael Foord
David Nicolson wrote: > This might do what you want to achieve. It seems to make py2exe crash > on exit, some file locking error. Works fine otherwise though. > > #!/usr/bin/env python > > import sys > > class LogBuffer: > def __init__(self): > pass > > def flush(self): >

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

2006-10-27 Thread David Nicolson
This might do what you want to achieve. It seems to make py2exe crash on exit, some file locking error. Works fine otherwise though. #!/usr/bin/env python import sys class LogBuffer: def __init__(self): pass def flush(self): sys.__stdout__.flush() def write(s

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

2006-10-27 Thread Johan Lindvall
Hi, Thanks for the answers so far. I am afraid my orginal post was a bit unclear. I am looking for a way to capture script output running in an ActiveScript Python host. -- /Johan. ___ Python-win32 mailing list Python-win32@python.org http://mail.pyth

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

2006-10-27 Thread Stefan Holmgren
You can add this after your script "> file.txt" Example: :you_script.py >korv.txt Then it will your print to the korv file.. /HejHopp "Johan Lindvall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Is there any way of capturing or displaying stdout when running a > Py

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

2006-10-27 Thread Johan Lindvall
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. ___ Python-win32 mailing list Python