Am 12.01.2012 06:23 schrieb Kushal Kumaran:
On Wed, Jan 4, 2012 at 8:05 PM, Mihai Badoiu<mbad...@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
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to