Piping stdout to Python callable

Antoon Pardon apardon at forel.vub.ac.be
Thu Aug 19 09:38:11 CEST 2004

Op 2004-08-19, Edward Diener schreef <eldiener at earthlink.net>:
> Antoon Pardon wrote:
>> Then I fear there is no other solution. As far as I understand, you
>> can't redirect standard output on a per thread basis, (at least not
>> in python.) That means that if you redirect stdout of the A.py module
>> to go into a pipe, the stdout of MyOwnModule.py will go into the
>> same pipe. I don't think you want that.
> Just wanted to write that someone else pointed out to me os.popen("python
> A.py") and that did work well as an alternative to using os.system(etc.) .
> Nonetheless thanks for your help. I mentioned this so that you would know
> also know about it yourself if you hadn't encountered it.

I know about popen, but that didn't seem to resolve your concern.
Working with popen will result in launching a second interpreter.
Since one of your mayor concerns about your own solution was
having two interpreters running, I didn't thought popen was a
viable solution.

Antoon Pardon

More information about the Python-list mailing list