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


Groups > comp.lang.python > #46588

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

From Peter Otten <__peter__@web.de>
Subject Re: Piping processes works with 'shell = True' but not otherwise.
Date 2013-05-31 11:52 +0200
Organization None
References <062f557e-8e1a-4efb-9178-7d685b47a834@googlegroups.com> <mailman.2202.1369602328.3114.python-list@python.org> <08aa32b7-0fb7-4665-83fa-5cc7ec36f898@googlegroups.com> <mailman.2366.1369847860.3114.python-list@python.org> <8c89fb10-63eb-446c-855b-f4c5406976ea@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.2480.1369993961.3114.python-list@python.org> (permalink)

Show all headers | View raw


Luca Cerone wrote:

>> 
>> That's because stdin/stdout/stderr take file descriptors or file
>> 
>> objects, not path strings.
>> 
> 
> Thanks Chris, how do I set the file descriptor to /dev/null then?

For example:

with open(os.devnull, "wb") as stderr:
    p = subprocess.Popen(..., stderr=stderr)
    ...


In Python 3.3 and above:

p = subprocess.Popen(..., stderr=subprocess.DEVNULL)

Back to comp.lang.python | Previous | NextPrevious 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