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


Groups > comp.lang.python > #77388

Re: subprocess module usage

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!news.tele.dk!news.tele.dk!small.news.tele.dk!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.017
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'causing': 0.04; 'argument': 0.05; 'parameter': 0.09; 'subject:module': 0.09; 'cc:addr:python-list': 0.11; 'attaching': 0.16; 'confuse': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'module?': 0.16; 'parameters,': 0.16; 'rather,': 0.16; 'splitting': 0.16; 'subject:usage': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'shell': 0.22; 'cc:addr:python.org': 0.22; 'mon,': 0.24; '(or': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'especially': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'work.': 0.31; 'easier': 0.31; '(although': 0.31; 'option.': 0.31; 'sep': 0.31; 'thanks!': 0.32; 'could': 0.34; 'problem': 0.35; 'something': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'wrong': 0.37; 'so,': 0.37; 'expected': 0.38; 'pm,': 0.38; 'rather': 0.38; 'quote': 0.39; 'either': 0.39; 'how': 0.40; "you're": 0.61; "you'll": 0.62; 'making': 0.63; 'act': 0.63; 'taking': 0.65; 'life': 0.66; 'here': 0.66; 'believe': 0.68; 'fact,': 0.69; '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=7I8pPc99nDMTSmXK0NFVuijCk0uFlle80hG5KDo1SFU=; b=az6gF2ZyVHZsuxvkGdqDOz3XwDkKCAjyCmW0nzvSKyDkCzIs7mBsbDccIgBPfC9tVK fDoOMQUMT3MJqtzSmYqRmu5zw7yclPHUEdU5bifLsnICSPn5DjAQBbCJf+zDs302jnpw ZKb2YFhN9x2/v+mHROPWuNAf5ZlFGypZNbjIH4maAbR/xPK7e77sA2XmnRJBib9bVw1b EhREdHnGOmBPGWRlnducHLa9kSgB+2WPHTxCxaadIJomN9FJ1wo5EK2XvUUdAlw4VgA/ zMtUXhi91YgTWMowjNl36fkf2MyS6VMTcuSZ5ISU1Y0HEVTtxsV0aP25qBGDCLT0Me2G yuDw==
MIME-Version 1.0
X-Received by 10.42.62.6 with SMTP id w6mr7780906ich.24.1409543710860; Sun, 31 Aug 2014 20:55:10 -0700 (PDT)
In-Reply-To <CAPrJNb4_m-1sqwzUcqnHR6jTFo-Tp=a1hLgTvXrujXW5sAUkpg@mail.gmail.com>
References <CAPrJNb4_m-1sqwzUcqnHR6jTFo-Tp=a1hLgTvXrujXW5sAUkpg@mail.gmail.com>
Date Mon, 1 Sep 2014 13:55:10 +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.13678.1409543719.18130.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1409543719 news.xs4all.nl 2917 [2001:888:2000:d::a6]:51489
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:77388

Show key headers only | View raw


On Mon, Sep 1, 2014 at 1:28 PM, Earl Lapus <earl.lapus@gmail.com> wrote:
> So, what could be causing this behavior? Is this expected or is there
> something wrong with how I'm using the subprocess module?

The latter. Your problem is with your shell= option.

Firstly, the parameter should be either shell=True or shell=False, not
shell="True". However, I don't believe that's making any difference
here (although shell="False" would act as shell=True, and confuse you
greatly).

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.

Meta-comment: Rather than attaching your code, please just include it
in-line. It's much easier to work with - especially when I want to
quote a line and respond to it. Thanks!

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 13:55 +1000

csiph-web