Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 8: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 s

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 9:03 PM, Benjamin Kaplan wrote: > 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 Bo

Re: Get subprocess error output from shell command

2011-04-02 Thread Gnarlodious
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.

Re: Get subprocess error output from shell command

2011-04-02 Thread Benjamin Kaplan
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 s

Re: Get subprocess error output from shell command

2011-04-02 Thread Gnarlodious
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

Re: Get subprocess error output from shell command

2011-04-02 Thread Gnarlodious
OK I get it, and that seems like it should work. But when I simulate a permissions error by setting the file to unwritable I get an error: outdata, errdata = process.communicate() Traceback (most recent call last): File "", line 1, in File "/Library/Frameworks/Python.framework/Versions/3.1/li

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 8:07 PM, Gnarlodious wrote: > I'm running a shell command like: > plutil -convert xml1 "~/Library/Preferences/iCab/iCab 4 Bookmarks" > > Getting error: > ~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied > > How would I capture this error using a method of subpr

Re: Get subprocess error output from shell command

2011-04-02 Thread Benjamin Kaplan
On Sat, Apr 2, 2011 at 11:07 PM, Gnarlodious wrote: > I'm running a shell command like: > plutil -convert xml1 "~/Library/Preferences/iCab/iCab 4 Bookmarks" > > Getting error: > ~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied > > How would I capture this error using a method of subp

Get subprocess error output from shell command

2011-04-02 Thread Gnarlodious
I'm running a shell command like: plutil -convert xml1 "~/Library/Preferences/iCab/iCab 4 Bookmarks" Getting error: ~/Library/Preferences/iCab/iCab 4 Bookmarks: Permission denied How would I capture this error using a method of subprocess? I read the doc at http://docs.python.org/release/3.0.1/l