Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #90891

Re: subprocess.getstatusoutput does not exist in 2.7

From Cecil Westerhof <Cecil@decebal.nl>
Newsgroups comp.lang.python
Subject Re: subprocess.getstatusoutput does not exist in 2.7
Organization Decebal Computing
References <87oalgtru5.fsf@Equus.decebal.nl> <slrnmlmt9q.864.jon+usenet@frosty.unequivocal.co.uk>
Date 2015-05-19 21:07 +0200
Message-ID <878ucktmhq.fsf@Equus.decebal.nl> (permalink)

Show all headers | View raw


Op Tuesday 19 May 2015 19:37 CEST schreef Jon Ribbens:

> On 2015-05-19, Cecil Westerhof <Cecil@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

Works like a charm. Thanks.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

subprocess.getstatusoutput does not exist in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 19:11 +0200
  Re: subprocess.getstatusoutput does not exist in 2.7 Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2015-05-19 17:37 +0000
    Re: subprocess.getstatusoutput does not exist in 2.7 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-19 21:07 +0200

csiph-web