[issue9922] subprocess.getstatusoutput can fail with utf8 UnicodeDecodeError

Antoine Pitrou report at bugs.python.org
Thu Dec 22 13:11:29 CET 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

Well, getoutput and getstatusoutput are arguably ugly.

However, since they are very high-level functions meant to quickly execute commands, returning str makes sense. You can't do anything smart with the output anyway, since stdout and stderr are intermingled: any binary data will be ruined by accompanying stderr output (e.g. warnings).

If you want to process the output data instead of displaying it to the user, use check_call() instead.

We could perhaps use the "surrogateescape" error handler in getoutput and getstatusoutput, but that's really putting lipstick on a pig.

----------
nosy: +ncoghlan, pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9922>
_______________________________________


More information about the Python-bugs-list mailing list