subprocess.getstatusoutput does not exist in 2.7
Jon Ribbens
jon+usenet at unequivocal.co.uk
Tue May 19 13:37:57 EDT 2015
On 2015-05-19, Cecil Westerhof <Cecil at decebal.nl> wrote:
> At the moment I want my code to run with 2.7 and 3.4+.
>
> But the command:
> subprocess.getstatusoutput
> does not exist in 2.7. Is this an oversight or is there a reason for
> it?
>
> I can rewrite the code (back) to work with Popen again, but I found
> the getstatusoutput elegant.
It's in the 'commands' module in Python 2. You could use the
following:
try:
from subprocess import getstatusoutput
except ImportError:
from commands import getstatusoutput
More information about the Python-list
mailing list