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


Groups > comp.lang.python > #46395

Re: Piping processes works with 'shell = True' but not otherwise.

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
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; 'subject:not': 0.03; 'output': 0.05; "subject:' ": 0.07; 'arguments': 0.09; 'imported': 0.09; 'objects,': 0.09; 'seemed': 0.09; 'strings.': 0.09; 'cc:addr :python-list': 0.11; '(it': 0.16; '/dev/null': 0.16; 'argument:': 0.16; 'chris,': 0.16; 'descriptors': 0.16; 'rest)': 0.16; 'wrote:': 0.18; 'help.': 0.21; 'cc:addr:python.org': 0.22; 'fine': 0.24; 'cheers,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'tried': 0.27; 'chris': 0.29; 'message-id:@mail.gmail.com': 0.30; 'publicly': 0.31; 'file': 0.32; 'run': 0.32; 'actual': 0.34; 'problem': 0.35; 'subject:with': 0.35; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'skip:s 60': 0.36; 'thanks': 0.36; 'clear': 0.37; 'sometimes': 0.38; 'pm,': 0.38; 'even': 0.60; 'skip:u 10': 0.60; 'commands': 0.60; 'first': 0.61; 'provide': 0.64; 'more': 0.64; 'to:addr:gmail.com': 0.65; '26,': 0.68; 'sender:addr:chris': 0.84; 'subject:True': 0.91; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=KHKyJhEhS3AnO1UxVF3z5ZYPNErbVtFai44aKN6TcCQ=; b=WU6VEO8CpVKLKoUSMr/yKN+VRMDvuYvyPMT0PIvEZcWSTSycnjYxnoY8qH04YlmUU8 1uRw51NtyslI1Uq/vBqv/IdO7ecn6pf6UB/mgzM+x02XVZAGpFP1qhH7HXIJSGfWRHCt VjPcvIJCAMKh9Pw2Y8ysV6Q916rpTc5MSv+9U=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=KHKyJhEhS3AnO1UxVF3z5ZYPNErbVtFai44aKN6TcCQ=; b=k+giuED84kt+XNordrUgiIYajpQAUcf0oxh6788Ln9iCL2dLFbhGq40GEEHNV+5Y8B jc+Q992cI+LBZK6H+pkPOCXhtc6xnJmlt3OFXLNgIquraFY1gqKa95gwBA8F4R8kFB6t R/Brg5Bo7NTTtEt10LuxXO5kJAe3fsHmArLy+ES0i2ufK+aUrG1eaFtRQ2UeUCFY53s7 42ZJlL7+4BMZry4CJZ48LPLgk0r8jP368ThqvKVzuhGVathrrIe+xcKluUuTQeArYwj7 8Kshb2rNirDFj8tTf5bi0fUhDj6BycMc4Z6F/u3I2FPzZ7UKvhh+QVHZSQBffCDNO/Cs ASSw==
MIME-Version 1.0
X-Received by 10.42.121.211 with SMTP id k19mr1035433icr.26.1369847857808; Wed, 29 May 2013 10:17:37 -0700 (PDT)
Sender chris@rebertia.com
In-Reply-To <08aa32b7-0fb7-4665-83fa-5cc7ec36f898@googlegroups.com>
References <062f557e-8e1a-4efb-9178-7d685b47a834@googlegroups.com> <mailman.2202.1369602328.3114.python-list@python.org> <08aa32b7-0fb7-4665-83fa-5cc7ec36f898@googlegroups.com>
Date Wed, 29 May 2013 10:17:37 -0700
X-Google-Sender-Auth wIfCXA8ifFOnmFaH7Mo_H5RA0WA
Subject Re: Piping processes works with 'shell = True' but not otherwise.
From Chris Rebert <clp2@rebertia.com>
To Luca Cerone <luca.cerone@gmail.com>
Content-Type text/plain; charset=UTF-8
X-Gm-Message-State ALoCoQm987Pmd8SwEjppIsfcfhSHjVPh0gL6QOe8CH4iNxyQ7y2EJnXuNjLCRBO7kvM9ATO7vEug
Cc python-list@python.org
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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2366.1369847860.3114.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1369847860 news.xs4all.nl 15918 [2001:888:2000:d::a6]:46044
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:46395

Show key headers only | View raw


On Sun, May 26, 2013 at 4:58 PM, Luca Cerone <luca.cerone@gmail.com> wrote:
<snip>
> Hi Chris, first of all thanks for the help. Unfortunately I can't provide the actual commands because are tools that are not publicly available.
> I think I get the tokenization right, though.. the problem is not that the programs don't run.. it is just that sometimes I get that error..
>
> Just to be clear I run the process like:
>
> p = subprocess.Popen(['program1','--opt1','val1',...'--optn','valn'], ... the rest)
>
> which I think is the right way to pass arguments (it works fine for other commands)..
<snip>
>> You may also want to provide /dev/null as p1's stdin, out of an abundance of caution.
>
> I tried to redirect the output to /dev/null using the Popen argument:
> 'stdin = os.path.devnull' (having imported os of course)..
> But this seemed to cause even more troubles...

That's because stdin/stdout/stderr take file descriptors or file
objects, not path strings.

Cheers,
Chris

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


Thread

Piping processes works with 'shell = True' but not otherwise. Luca Cerone <luca.cerone@gmail.com> - 2013-05-24 07:04 -0700
  Re: Piping processes works with 'shell = True' but not otherwise. Luca Cerone <luca.cerone@gmail.com> - 2013-05-26 03:31 -0700
  Re: Piping processes works with 'shell = True' but not otherwise. Chris Rebert <clp2@rebertia.com> - 2013-05-26 14:05 -0700
    Re: Piping processes works with 'shell = True' but not otherwise. Luca Cerone <luca.cerone@gmail.com> - 2013-05-26 16:58 -0700
      RE: Piping processes works with 'shell = True' but not otherwise. Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-27 03:14 +0300
        Re: Piping processes works with 'shell = True' but not otherwise. Thomas Rachel <nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915@spamschutz.glglgl.de> - 2013-05-29 19:39 +0200
          RE: Piping processes works with 'shell = True' but not otherwise. Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-29 22:31 +0300
          Re: Piping processes works with 'shell = True' but not otherwise. Cameron Simpson <cs@zip.com.au> - 2013-05-30 08:18 +1000
      Re: Piping processes works with 'shell = True' but not otherwise. Chris Angelico <rosuav@gmail.com> - 2013-05-27 18:28 +1000
        Re: Piping processes works with 'shell = True' but not otherwise. Luca Cerone <luca.cerone@gmail.com> - 2013-05-27 04:33 -0700
      Re: Piping processes works with 'shell = True' but not otherwise. Chris Rebert <clp2@rebertia.com> - 2013-05-29 10:17 -0700
        Re: Piping processes works with 'shell = True' but not otherwise. Luca Cerone <luca.cerone@gmail.com> - 2013-05-31 02:28 -0700
          Re: Piping processes works with 'shell = True' but not otherwise. Peter Otten <__peter__@web.de> - 2013-05-31 11:52 +0200

csiph-web