Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #32262
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python@mrabarnett.plus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'deprecated': 0.07; 'line:': 0.07; 'scripts': 0.09; 'python': 0.09; 'indicates': 0.09; 'porting': 0.09; 'stderr': 0.09; 'tuple': 0.09; 'suggest': 0.11; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'module:': 0.16; 'stdout:': 0.16; 'subprocess': 0.16; 'wrote:': 0.17; 'shell': 0.18; 'trying': 0.21; 'parse': 0.22; 'this:': 0.23; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; '[1]': 0.27; 'member.': 0.27; 'piece': 0.29; 'received:192.168.1.3': 0.29; "i'm": 0.29; 'code': 0.31; 'gets': 0.32; 'anybody': 0.32; 'skip:s 30': 0.33; 'subject:change': 0.33; 'to:addr:python-list': 0.33; 'hi,': 0.33; 'should': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'here': 0.65; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'case?': 0.84; 'explanation:': 0.84; 'reply- to:addr:python.org': 0.84 |
| X-CM-Score | 0.00 |
| X-CNFS-Analysis | v=2.0 cv=XYELPfF5 c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=b2nRVtXOy8EA:10 a=FMschXuvAVwA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=CNm48DRdZ8IA:10 a=gkR-cCeKDPAR8O4OecQA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 |
| X-AUTH | mrabarnett:2500 |
| Date | Sat, 27 Oct 2012 04:02:06 +0100 |
| From | MRAB <python@mrabarnett.plus.com> |
| User-Agent | Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: how to change os.popen4 to subprocess |
| References | <c6bac1cc-abda-4d95-b3b4-e96dc7ab7a3a@r8g2000pbs.googlegroups.com> |
| In-Reply-To | <c6bac1cc-abda-4d95-b3b4-e96dc7ab7a3a@r8g2000pbs.googlegroups.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | python-list@python.org |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2928.1351306928.27098.python-list@python.org> (permalink) |
| Lines | 31 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1351306928 news.xs4all.nl 6844 [2001:888:2000:d::a6]:48073 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:32262 |
Show key headers only | View raw
On 2012-10-27 03:28, skyworld wrote: > Hi, > > I'm new to python and I'm trying to porting some scripts from v0.96 to > v2.0.1. A piece of code is like this: > > cmd_h = os.popen4(env['SYSCMDLINE'])[1] > > the system indicates the popen4 is deprecated and suggest to use > subprocess. Can anybody tell me how to use subprocess in this case? > and what does "[1]" here means? > os.popen4 returns a tuple of (child_stdin, child_stdout_and_stderr). The [1] gets the child_stdout_and_stderr member. Using the subprocess module: # Untested! cmd_h = subprocess.Popen(env['SYSCMDLINE'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True).stdout Explanation: The command line: env['SYSCMDLINE'] Return stdout: stdout=subprocess.PIPE stderr should be combined with stdout: stderr=subprocess.STDOUT Let the shell parse the command line: shell=True
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
how to change os.popen4 to subprocess skyworld <chenyong20000@gmail.com> - 2012-10-26 19:28 -0700
Re: how to change os.popen4 to subprocess MRAB <python@mrabarnett.plus.com> - 2012-10-27 04:02 +0100
Re: how to change os.popen4 to subprocess skyworld <chenyong20000@gmail.com> - 2012-10-26 23:30 -0700
RE: how to change os.popen4 to subprocess "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-10-30 14:47 +0000
Re: how to change os.popen4 to subprocess Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-10-27 04:10 +0100
csiph-web