Message117176
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. |
|
Date |
User |
Action |
Args |
2010-09-23 10:19:43 | ned.deily | set | recipients:
+ ned.deily, astrand, debatem1 |
2010-09-23 10:19:43 | ned.deily | set | messageid: <1285237183.57.0.348540643055.issue9922@psf.upfronthosting.co.za> |
2010-09-23 10:19:41 | ned.deily | link | issue9922 messages |
2010-09-23 10:19:39 | ned.deily | create | |
|