Bugs item #1238747, was opened at 2005-07-15 10:31
Message generated for change (Comment added) made by astrand
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1238747&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Platform-specific
>Status: Closed
>Resolution: Duplicate
Priority: 5
Private: No
Submitted By: Adam Kerrison (adamk550)
Assigned to: Peter Åstrand (astrand)
Summary: subprocess.Popen fails inside a Windows service

Initial Comment:
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.



----------------------------------------------------------------------

>Comment By: Peter Åstrand (astrand)
Date: 2007-01-22 20:33

Message:
Logged In: YES 
user_id=344921
Originator: NO

Duplicate of 1124861. 

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1238747&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to