subprocess module usage

Chris Angelico rosuav at gmail.com
Mon Sep 1 05:55:10 CEST 2014


On Mon, Sep 1, 2014 at 1:28 PM, Earl Lapus <earl.lapus at 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



More information about the Python-list mailing list