Question about StringIO

Steve Holden steve at holdenweb.com
Sun Oct 9 06:34:33 EDT 2005


Frank Millman wrote:
> Hi all
> 
> I understand that StringIO creates a file-like object in memory.
> 
> Is it possible to invoke another program, using os.system() or
> os.popen(), and use the < redirect operator, so that the other program
> reads my StringIO object as its input?
> 
> I will provide more details if required, but hopefully this is enough
> for a simple yes or no answer, and if so, how.
> 
> BTW, I have tried using popen2() and passing my data via stdin, but the
> other program (psql) does not react well to this - again, I will give
> more info if necessary.
> 
Unfortunately the StringIO module only creates instances inside the 
process they are called: these objects have no existence to the 
operating system or to other processes, and so can't be used for 
inter-process communication.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC                     www.holdenweb.com
PyCon TX 2006                  www.python.org/pycon/




More information about the Python-list mailing list