Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.05; 'appropriate.': 0.09; 'subject:module': 0.09; 'worked.': 0.09; 'wrong,': 0.09; 'cc:addr:python-list': 0.11; 'chris,': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'parameters,': 0.16; 'rather,': 0.16; 'splitting': 0.16; 'subject:usage': 0.16; 'weird': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'fairly': 0.24; 'mon,': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'on,': 0.29; 'am,': 0.29; 'errors': 0.30; 'message- id:@mail.gmail.com': 0.30; 'work.': 0.31; 'invoke': 0.31; 'sep': 0.31; 'this.': 0.32; 'thanks!': 0.32; 'open': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'should': 0.36; 'changing': 0.37; 'clear': 0.37; 'pm,': 0.38; 'sure': 0.39; "you're": 0.61; "you'll": 0.62; 'taking': 0.65; 'life': 0.66; 'fact,': 0.69; 'yourself': 0.78; 'glad': 0.83; 'earl': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Ew4CIdQ4q+grDKlnh3Z3BoxzX9OQtnDpxKQ1yz+8lmU=; b=knwnIsF+QplH49esmTmqbCKi5BJ69NIJUbdezW3HNTTY1tqdnNcc8FVmILB5aJmUcd 2+1di81WRj0mKcusD7ki2LfgWVp1qIAOPiHp7Tn4ITUxjRJX8fmwiEVUDpIrsGMHCMnE xTusvmhxu3EGiM79DSTZxE7/F4yZ8N3n067udSFy+woCtEijH3euvbvgSifb1r/1dVsI e5vSoVf+g1Xp11ECGwVTiqWKBdUG7ruoXor/cS1I1+2PV7PB9dPwgHys0AvjB9i5HCaV BFX0/ZhBGRNT5ZXDluncPeMvQxA/PmTZ1hxnUPeDO7wurjxApUEGAtFnIzyWyizVa9/x VTZg== MIME-Version: 1.0 X-Received: by 10.43.149.200 with SMTP id kl8mr4413386icc.52.1409549987435; Sun, 31 Aug 2014 22:39:47 -0700 (PDT) In-Reply-To: References: Date: Mon, 1 Sep 2014 15:39:47 +1000 Subject: Re: subprocess module usage From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1409549990 news.xs4all.nl 2836 [2001:888:2000:d::a6]:43732 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:77393 On Mon, Sep 1, 2014 at 3:24 PM, Earl Lapus wrote: > On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico wrote: >> >> But secondly, you're already splitting the argument (or rather, taking >> it from your own parameters, already split), so you don't want to go >> through the shell. In fact, going through the shell would only make >> your life harder. Change that to shell=False and you'll see everything >> work. >> > > Changing shell value to False worked. I appreciate your help Chris, Thanks! Glad it's working! But please, don't just take my word for it and make a black-box change to your code. When you invoke subprocesses, be sure you understand what's going on, and when shell=True is appropriate and when shell=False is appropriate. The docs should be fairly clear on this. If you get this sort of thing wrong, you'll get weird errors like this (if you're lucky), or open yourself up to shell injection vulnerabilities (if you're not). ChrisA