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


Groups > comp.lang.python > #77393

Re: subprocess module usage

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 <rosuav@gmail.com>
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 <CAPrJNb7Ur9sTqhWoxMWzTFCBJkLrm--rW8aq_aK36w9meYDG-A@mail.gmail.com>
References <CAPrJNb4_m-1sqwzUcqnHR6jTFo-Tp=a1hLgTvXrujXW5sAUkpg@mail.gmail.com> <CAPTjJmrq-azU3CvKi9FqxXNYALJu_cF-WtjTcB4YDnTectyCCA@mail.gmail.com> <CAPrJNb7Ur9sTqhWoxMWzTFCBJkLrm--rW8aq_aK36w9meYDG-A@mail.gmail.com>
Date Mon, 1 Sep 2014 15:39:47 +1000
Subject Re: subprocess module usage
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.13682.1409549990.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Mon, Sep 1, 2014 at 3:24 PM, Earl Lapus <earl.lapus@gmail.com> wrote:
> On Mon, Sep 1, 2014 at 11:55 AM, Chris Angelico <rosuav@gmail.com> 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

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


Thread

Re: subprocess module usage Chris Angelico <rosuav@gmail.com> - 2014-09-01 15:39 +1000

csiph-web