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: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'deprecated': 0.07; 'scripts': 0.09; 'python': 0.09; 'indicates': 0.09; 'porting': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'suggest': 0.11; '2.7.3': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subprocess': 0.16; 'wrote:': 0.17; 'certainly': 0.17; 'module': 0.19; 'versions': 0.20; 'trying': 0.21; 'thanks.': 0.21; 'this:': 0.23; 'specifically': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; '[1]': 0.27; 'header:X-Complaints-To:1': 0.28; 'piece': 0.29; "i'm": 0.29; 'code': 0.31; 'problem.': 0.32; 'url:python': 0.32; 'anybody': 0.32; 'from:addr:yahoo.co.uk': 0.32; 'subject:change': 0.33; 'to:addr:python-list': 0.33; 'tutorial': 0.33; 'hi,': 0.33; 'received:org': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'problems': 0.36; 'does': 0.37; 'subject:: ': 0.38; 'mark': 0.38; 'some': 0.38; 'url:docs': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'most': 0.61; "you've": 0.61; 'first': 0.61; 'url:index': 0.61; 'here': 0.65; 'talking': 0.66; 'case?': 0.84; 'received:2': 0.91; 'url:tutorial': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: how to change os.popen4 to subprocess Date: Sat, 27 Oct 2012 04:10:33 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-2-98-194-32.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 In-Reply-To: X-Antivirus: avast! (VPS 121026-1, 26/10/2012), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1351307261 news.xs4all.nl 6856 [2001:888:2000:d::a6]:51415 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:32263 On 27/10/2012 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: What software are you talking about here, it's certainly not Python versions as the most up to date are 2.7.3 and 3.3.0? > > 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? If you don't know what the [1] means you've got problems :) I suggest you read the tutorial here first http://docs.python.org/tutorial/index.html then the subprocess module here http://docs.python.org/library/subprocess.html#module-subprocess, specifically http://docs.python.org/library/subprocess.html#subprocess-replacements > > thanks. > No problem. -- Cheers. Mark Lawrence.