Question about StringIO

Diez B. Roggisch deets at nospam.web.de
Sun Oct 9 12:40:21 CEST 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?

No. Processes don't share memory - thus you have to either use a temp 
file, or pipes.

> 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.

Better do so :)

Diez



More information about the Python-list mailing list