error on windows with commands.getstatusoutput

Lee Harr missive at
Wed Dec 31 18:18:35 CET 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,

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™.

More information about the Python-list mailing list