Ned Deily <n...@acm.org> added the comment: In Python 3, subprocess.Popen returns stdout as "bytes" rather than "string" so it seems reasonable that subprocess.getstatusoutput should do the same.
>>> subprocess.Popen(['dd if=/dev/random bs=1024 count=1'], shell=True, >>> stdout=subprocess.PIPE).communicate()[0] 1+0 records in 1+0 records out 1024 bytes transferred in 0.000142 secs (7218432 bytes/sec) b'\x11\xfb\xe1w ... The problem is reproducible on 3.1 and py3k. The attached patch for py3k (with a backport to 3.1) corrects getstatusoutput to return bytes. It also includes a test case and updates the docs to show byte output. ---------- keywords: +patch nosy: +astrand, ned.deily stage: -> patch review title: subprocess.getstatusoutput and bytes -> subprocess.getstatusoutput can fail with utf8 UnicodeDecodeError versions: +Python 3.1 Added file: http://bugs.python.org/file18971/issue9922-py3k.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9922> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com