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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!feeds.phibee-telecom.net!news.panservice.it!feed.xsnews.nl!border02.ams.xsnews.nl!feeder04.ams.xsnews.nl!abp001.ams.xsnews.nl!frontend-F09-20.ams.news.kpn.nl
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>
X-Face "(y8cC@tg_12{">GF'UXTW]FHI2wMiZNrnf'1EFQ&O#$m:f#O7+7}kR<J%a^F2lh4[N~Yz4 nSp#c+aQo1b5=?HcNEkQ7QzF<])O3X4MDL/AYjys&*mt>,v+Pti8=Vi/Z"g^?b"E
X-Homepage http://www.decebal.nl/
Date Tue, 19 May 2015 21:07:13 +0200
Message-ID <878ucktmhq.fsf@Equus.decebal.nl> (permalink)
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)
Cancel-Lock sha1:xOWr9HJT2Ub57+rg6U5STdgibmQ=
MIME-Version 1.0
Content-Type text/plain
Lines 25
NNTP-Posting-Host 81.207.62.244
X-Trace 1432063766 news.kpn.nl 32735 81.207.62.244@kpn/81.207.62.244:56777
Xref csiph.com comp.lang.python:90891

Show key headers only | 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