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: 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: <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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious 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 >