creating size-limited tar files
Kushal Kumaran
kushal.kumaran+python at gmail.com
Wed Nov 14 03:51:32 EST 2012
Ian Kelly <ian.g.kelly at gmail.com> writes:
> 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.
Well, well, I was wrong, clearly. I wonder if this is fixable.
--
regards,
kushal
More information about the Python-list
mailing list