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

Re: Get subprocess error output from shell command

2011-04-02 Thread Benjamin Kaplan
On Sat, Apr 2, 2011 at 11:07 PM, Gnarlodious gnarlodi...@gmail.com 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

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
On Sat, Apr 2, 2011 at 8:07 PM, Gnarlodious gnarlodi...@gmail.com 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

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 stdin, line 1, in module File

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 Benjamin Kaplan
On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious gnarlodi...@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

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 Chris Rebert
On Sat, Apr 2, 2011 at 9:03 PM, Benjamin Kaplan benjamin.kap...@case.edu wrote: On Sat, Apr 2, 2011 at 11:50 PM, Gnarlodious gnarlodi...@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()

Re: Get subprocess error output from shell command

2011-04-02 Thread Chris Rebert
quote what=earlier relevant post reason=context On Sat, Apr 2, 2011 at 8:50 PM, Gnarlodious gnarlodi...@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