capture stdout and stderror from within a Windows Service?

David Lyon david.lyon at preisshare.net
Thu May 14 21:31:42 EDT 2009


On Thu, 14 May 2009 11:16:51 -0500, Grant Edwards <invalid at invalid> wrote:
> On 2009-05-14, 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"]

In the past, windows services have never been allowed to make any output
to the console or the GDI or get any user input. Rules said they could 
send stuff to syslog etc.

All writing can go to logfiles and so forth...

I've never heard of that being allowable....

David




More information about the Python-list mailing list