stdin/stdout fileno() always returning -1 from windows service

Jeff Epler jepler at unpythonic.net
Mon Jul 18 09:30:12 EDT 2005


On Sun, Jul 17, 2005 at 06:43:00PM -0700, chuck wrote:
> I have found that sys.stdin.fileno() and sys.stdout.fileno() always
> return -1 when executed from within a win32 service written using the
> win32 extensions for Python.
> 
> Anyone have experience with this or know why?

because there *is* no standard I/O for a windows service.

You should be able to execute code like
    import sys
    sys.stdout = sys.stderr = open("some.log", "w")
if you have code that expects the standard output files to be available.
You could also open sys.stdin in a similar way.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050718/3e4f4fb1/attachment.sig>


More information about the Python-list mailing list