creating size-limited tar files

Ian Kelly ian.g.kelly at gmail.com
Wed Nov 14 08:22:48 CET 2012


On Tue, Nov 13, 2012 at 11:05 PM, Kushal Kumaran
<kushal.kumaran+python at gmail.com> wrote:
> Or, you could just change the p1's stderr to an io.BytesIO instance.
> Then call p2.communicate *first*.

This doesn't seem to work.

>>> b = io.BytesIO()
>>> p = subprocess.Popen(["ls", "-l"], stdout=b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.2/subprocess.py", line 711, in __init__
    errread, errwrite) = self._get_handles(stdin, stdout, stderr)
  File "/usr/lib64/python3.2/subprocess.py", line 1112, in _get_handles
    c2pwrite = stdout.fileno()
io.UnsupportedOperation: fileno

I think stdout and stderr need to be actual file objects, not just
file-like objects.


More information about the Python-list mailing list