error on windows with commands.getstatusoutput
Lee Harr
missive at hotmail.com
Wed Dec 31 12:18:35 EST 2008
> Anyhow, I've replaced it with this:
>
>
> from subprocess import Popen, PIPE, STDOUT
> p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE,
> stderr=STDOUT, close_fds=True)
> output, unused = p.communicate()
> status = p.returncode
>
>
> Does that look more windows-friendly?
Unfortunately, no.
close_fds is also not available on windows (or at least not
when trying to capture stderr with stdout like this.)
So, now I'm going with ...
p = Popen(cmd, shell=True, stdin=PIPE, stdout=PIPE,
stderr=STDOUT)
I don't really understand what close_fds does. I only put it
in because it was in the example code.
I have a report that this code works on windows,
and it is also working for me on linux.
_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/
More information about the Python-list
mailing list