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


Groups > comp.lang.python > #2497

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 <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'string.': 0.04; 'see:': 0.07; '>>>>': 0.09; 'tuple': 0.09; 'pm,': 0.11; 'output': 0.12; 'subject:error': 0.12; 'wrote:': 0.14; '*nix': 0.16; "b'')": 0.16; 'instantiate': 0.16; 'outputs': 0.16; 'rebert': 0.16; 'stderr': 0.16; 'subject:command': 0.16; 'subject:subprocess': 0.16; 'permission': 0.16; 'url:blog': 0.18; 'object,': 0.19; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.20; 'cheers,': 0.20; 'seems': 0.21; 'header:In-Reply-To:1': 0.22; 'cc:addr:python-list': 0.22; 'indicating': 0.23; 'received:209.85.214.174': 0.23; 'received :mail-iw0-f174.google.com': 0.23; 'skip:( 30': 0.24; 'chris': 0.27; 'message-id:@mail.gmail.com': 0.28; "doesn't": 0.28; 'string': 0.29; 'error': 0.29; 'sat,': 0.29; 'exit': 0.29; 'cc:addr:python.org': 0.31; 'however,': 0.31; 'communicate': 0.35; 'conventions': 0.35; 'status,': 0.35; 'rather': 0.36; 'message,': 0.37; 'received:209.85': 0.37; 'apr': 0.38; 'received:google.com': 0.38; 'received:209.85.214': 0.39; 'received:209': 0.39; 'empty': 0.40; 'would': 0.40; 'header:Received:5': 0.40; '2011': 0.62; 'here': 0.65; 'response.': 0.67; 'subject:Get': 0.74; '9:00': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=WgLwmPMeJIw1WNdaDdF9Kji20HG/A4fBwRxcS8x2C80=; b=DK09v4YMu7uBvyxJrhxx1ppbIOG4c7GuiShj0L+scZ/keT+xxOo3vWYCLSQCy/zoVL nJ1xN0HpcUc+sKe71wiki7NkbZmf29apVoK3tdYj4LpkoHp5wKfIT0AXFieI3ivF/2HB PW9TdVXpirzSZXhpBwm5zIbA4HweZb/KMXX1A=
DomainKey-Signature a=rsa-sha1; c=nofws; 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 :content-transfer-encoding; b=MkYR08X4NbkkVE1AvkrA5d1NEcBQXypTikC6SPQH6dioggIZSR6Wykd8Alfp53YzTo CeM+lx4WgkXRgur+2YpBt5zk3NZJkGkhnN4PMs40h4lV+y6+sv4QMMk5iqT1aM1q9n0l GWtsEtnFDf34Fesc885s2I+sxR/xbB7xW62Vw=
MIME-Version 1.0
Sender chris@rebertia.com
In-Reply-To <8d22e277-5f5f-473f-9ddf-21acee876f9a@i4g2000pro.googlegroups.com>
References <dc8e1dcd-303c-4e07-bdda-1b12277976f0@f31g2000pri.googlegroups.com> <mailman.150.1301801357.2990.python-list@python.org> <8d22e277-5f5f-473f-9ddf-21acee876f9a@i4g2000pro.googlegroups.com>
Date Sat, 2 Apr 2011 21:14:25 -0700
X-Google-Sender-Auth hHmepbYux9_xdx_MkhmZl6bR-zA
Subject Re: Get subprocess error output from shell command
From Chris Rebert <clp2@rebertia.com>
To Gnarlodious <gnarlodious@gmail.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
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.153.1301804067.2990.python-list@python.org> (permalink)
Lines 30
NNTP-Posting-Host 82.94.164.166
X-Trace 1301804067 news.xs4all.nl 41113 [::ffff:82.94.164.166]:44667
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:2497

Show key headers only | View raw


<quote what="earlier relevant post" reason="context">
On Sat, Apr 2, 2011 at 8: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,
</quote>

On Sat, Apr 2, 2011 at 9:00 PM, Gnarlodious <gnarlodious@gmail.com> wrote:
> On Apr 2, 9:29 pm, Chris Rebert wrote:
>
>> if proc.returncode: # non-zero exit status, indicating error
>>     print("Encountered error:")
>>     print(error_output) # output the error message
>>
>
> Like in my previous post, this only outputs an empty string.
> Apparently plutil doesn't communicate well.

Yes, it seems to output its error message to stdout, rather than
stderr in line with *nix conventions as one would expect.

Cheers,
Chris
--
http://blog.rebertia.com

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