pipe into preallocated buffer?
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Thu Jan 12 01:11:15 EST 2012
Am 12.01.2012 06:23 schrieb Kushal Kumaran:
> On Wed, Jan 4, 2012 at 8:05 PM, Mihai Badoiu<mbadoiu at gmail.com> wrote:
>> is there a way to pipe directly into a preallocated buffer?
>> (subprocessing.pipe.stdout)
>>
>
> Does io.StringIO fit your needs?
>
> http://docs.python.org/py3k/library/io.html#io.StringIO
Probably not. A file object used in the subprocess context needs a
fileno() method. StringIO objects don't have such.
Probably it is necessary to use subprocess.communicate() (for rather
small data lengths) or to use sp.stdout.read() to read it manually.
Thomas
More information about the Python-list
mailing list