By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,956 Members | 1,457 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,956 IT Pros & Developers. It's quick & easy.

CreateProcess / redirect output

P: n/a
Hi,

I try to start a process on windows using win32process.CreateProcess and
want to to redirect the output. I set the STARTF_USESTDHANDLES flag in the
STARTUPINFO structure. But I can not figure out, how to get the pipes
working. My app either deadlocks or displays the error messag:

....
print win32file.ReadFile(readStdOut,10)
pywintypes.error: (109, 'ReadFile', 'The pipe has been ended.')

I think I'm not the only one which needs to get the output of an external
process on windows. Is there a simpler solutions or has somebody a working
example to share?

regards,
Achim
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

[Achim]
I try to start a process on windows using win32process.CreateProcess [...]
I think I'm not the only one which needs to get the output of an external
process on windows.


Unless you have a specific reason for using CreateProcess, you can use
os.popen*() - see http://www.python.org/doc/current/li...ewstreams.html

If you really do need to use CreateProcess, this might help:
http://msdn.microsoft.com/library/de...and_output.asp

--
Richie Hindle
ri****@entrian.com
Jul 18 '05 #2

P: n/a
"Richie Hindle" <ri****@entrian.com> wrote in message
news:ma*************************************@pytho n.org...
Unless you have a specific reason for using CreateProcess, you can use
os.popen*() - see http://www.python.org/doc/current/li...ewstreams.html
The code is part of a COM object which is used in an ASP page. Using popen I
get the following error:

[Errno 5] Access is denied: 'C:\\WINDOWS\\system32\\cmd.exe /c
path_to\\ExtractingDummy.exe "path_to\\some_dummy.doc"'

The IUSER has the required rights on all these files. Don't know how to
solve that.
If you really do need to use CreateProcess, this might help:

http://msdn.microsoft.com/library/de...us/dllproc/bas
e/creating_a_child_process_with_redirected_input_and _output.asp

That looks like the info I was looking for. Thanks!

Achim
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.