This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author adamk550
Recipients
Date 2005-07-15.08:31:54
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
If you use subprocess.Popen() from within a Windows service and 
you try to redirect stdout or stderr, the call will fail with a TypeError.

The issue appears to be that if you attempt to redirect stdout and/or 
stderr, the module also needs to set up stdin. Since you haven't 
specified what to do with stdin, the code simple duplicates the 
processes stdin handle using GetStdHandle(STD_INPUT_HANDLE)

However, a Windows service doesn't have stdin etc so the returned 
handle is None. This handle is then passed to DuplicateHandle() 
which fails with the TypeError.

A workaround is to explictly PIPE stdin but I have found at least one 
Windows program (the RCMD.EXE utility) that fails if its stdin is a 
pipe! (RCMD says "Internal Error 109" ...)

The only other workaround is a to explictly open the NUL device and 
use that for stdin.

History
Date User Action Args
2007-08-23 14:33:09adminlinkissue1238747 messages
2007-08-23 14:33:09admincreate