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() >> (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? > > 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.
However, using subprocess.check_call() or subprocess.check_output() will cause a non-zero exit code to raise a Python exception, CalledProcessError. http://docs.python.org/library/subprocess.html#subprocess.check_call http://docs.python.org/library/subprocess.html#subprocess.check_output Cheers, Chris -- http://mail.python.org/mailman/listinfo/python-list