capture stdout and stderror from within a Windows Service?

Chris Rebert clp2 at rebertia.com
Thu May 14 12:08:08 EDT 2009


On Thu, May 14, 2009 at 8:57 AM, Chris Curvey <ccurvey at gmail.com> wrote:
> I'm trying to get this invocation right, and it is escaping me.  How
> can I capture the stdout and stderr if I launch a subprocess using
> subprocess.check_call()?  The twist here is that the call is running
> from within a Windows service.
>
> I've tried:
>
> check_call("mycmd.exe", stdout=subprocess.PIPE)  [raises an exception
> "An integer is required"]
>
> check_call("mycmd.exe", stdout=file("c:\\temp\\foobar.txt", "w"))
> [raises an exception "An integer is required"]

Providing the full exception Tracebacks would be highly recommended.

Cheers,
Chris
-- 
http://blog.rebertia.com



More information about the Python-list mailing list