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

2005-07-18 Thread chuck
"common wisdom" interesting.

The value of the closed attribute is "False" when tested from within
the service.

Still digging

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-07-18 Thread Jeff Epler
It seems to simply be common wisdom.  e.g.,
http://mail.python.org/pipermail/python-win32/2004-September/002332.html
http://mail.mems-exchange.org/pipermail/quixote-users/2004-March/002743.html
http://twistedmatrix.com/pipermail/twisted-python/2001-December/000644.html
etc

If you can find chapter and verse on MSDN, more power to you.  This page
implies that the "standard handles" are only available when there is a
console for the application.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getstdhandle.asp

Jeff


pgpD1VX32k6bY.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list

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

2005-07-18 Thread chuck
Interesting.  The stdin and stdout objects in my service seems respond
to returing a string for the statements str(sys.stdin) and
str(sys.stdout).  I guess they are just not attached to files?

Can you provide a reference (MSDN or otherwise) that indicates that
Windows Services don't have standard I/O?

-- 
http://mail.python.org/mailman/listinfo/python-list


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

2005-07-18 Thread Jeff Epler
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


pgpMaSZazXzRr.pgp
Description: PGP signature
-- 
http://mail.python.org/mailman/listinfo/python-list