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


Groups > comp.lang.python > #2495

Re: Get subprocess error output from shell command

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <bsk16@case.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'see:': 0.07; 'python': 0.07; '>>>>': 0.09; 'exception.': 0.09; 'tuple': 0.09; 'pm,': 0.11; 'subject:error': 0.12; 'wrote:': 0.14; "b'')": 0.16; 'instantiate': 0.16; 'osx': 0.16; 'posix': 0.16; 'shells': 0.16; 'subject:command': 0.16; 'subject:subprocess': 0.16; 'permission': 0.16; 'code.': 0.18; 'object,': 0.19; 'simpler': 0.19; 'code,': 0.20; 'header:In-Reply-To:1': 0.22; 'parse': 0.23; 'skip:( 30': 0.24; 'url:mailman': 0.27; 'work.': 0.27; 'message- id:@mail.gmail.com': 0.28; 'string': 0.29; 'error': 0.29; 'sat,': 0.29; 'however,': 0.31; 'to:addr:python-list': 0.32; 'url:listinfo': 0.33; 'fails': 0.35; 'message,': 0.37; 'url:python': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'url:org': 0.38; 'to.': 0.39; 'to:addr:python.org': 0.39; 'how': 0.39; '2011': 0.62; 'here': 0.65; 'response.': 0.67; 'subject:Get': 0.74; '11:50': 0.84; 'received:129': 0.84
MIME-Version 1.0
In-Reply-To <7d8d2159-20ac-4bdc-afa8-f28b8ee29394@d26g2000prn.googlegroups.com>
References <dc8e1dcd-303c-4e07-bdda-1b12277976f0@f31g2000pri.googlegroups.com> <mailman.150.1301801357.2990.python-list@python.org> <7d8d2159-20ac-4bdc-afa8-f28b8ee29394@d26g2000prn.googlegroups.com>
Date Sun, 3 Apr 2011 00:03:33 -0400
Subject Re: Get subprocess error output from shell command
From Benjamin Kaplan <benjamin.kaplan@case.edu>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
X-Junkmail-Status score=10/49, host=mpv2.tis.cwru.edu
X-Junkmail-SD-Raw score=unknown, refid=str=0001.0A020205.4D97F197.000C,ss=1,fgs=0, ip=74.125.82.182, so=2010-02-10 23:06:36, dmn=2009-09-10 00:05:08, mode=single engine
X-Junkmail-IWF false
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.151.1301803423.2990.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 82.94.164.166
X-Trace 1301803423 news.xs4all.nl 41113 [::ffff:82.94.164.166]:58283
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2495

Show key headers only | View raw


On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious <gnarlodious@gmail.com> wrote:
> I get it, you instantiate an object, call a method and get a tuple in
> response. However, here is what I see:
>
>>>> process.communicate()
> (b'~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied\n',
> b'')
>
> So all I get is the string and no error message, which is the same
> thing I get with the simpler subprocess.call(). I can parse out the
> error out and handle it if I need to. Is this a failing in the OSX
> plutil tool?
>
> -- Gnarlie
> --

Were you expecting a Python error? That's not how POSIX shells work. A
process that fails just gives you a non-zero return code, not an
exception. You can call process.poll() to get the return code.


> http://mail.python.org/mailman/listinfo/python-list
>

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


Thread

Get subprocess error output from shell command Gnarlodious <gnarlodious@gmail.com> - 2011-04-02 20:07 -0700
  Re: Get subprocess error output from shell command Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-04-02 23:25 -0400
    Re: Get subprocess error output from shell command Gnarlodious <gnarlodious@gmail.com> - 2011-04-02 20:36 -0700
  Re: Get subprocess error output from shell command Chris Rebert <clp2@rebertia.com> - 2011-04-02 20:29 -0700
    Re: Get subprocess error output from shell command Gnarlodious <gnarlodious@gmail.com> - 2011-04-02 20:50 -0700
      Re: Get subprocess error output from shell command Benjamin Kaplan <benjamin.kaplan@case.edu> - 2011-04-03 00:03 -0400
      Re: Get subprocess error output from shell command Chris Rebert <clp2@rebertia.com> - 2011-04-02 21:10 -0700
    Re: Get subprocess error output from shell command Gnarlodious <gnarlodious@gmail.com> - 2011-04-02 21:00 -0700
      Re: Get subprocess error output from shell command Chris Rebert <clp2@rebertia.com> - 2011-04-02 21:14 -0700

csiph-web