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: 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> <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 To: Luca Cerone 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sun, May 26, 2013 at 4:58 PM, Luca Cerone wrote: > 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).. >> 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