CreateProcess / redirect output

A

Achim Domma

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
 
R

Richie Hindle

A

Achim Domma

Unless you have a specific reason for using CreateProcess, you can use
os.popen*() - see http://www.python.org/doc/current/lib/os-newstreams.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/default.asp?url=/library/en-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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top