Reading from an External Buffer

Bill Orcutt b_orcutt at pobox.com
Sun Mar 23 01:04:06 EST 2003


Hi-

I working on a Macintosh C program that embeds some python code. I'm
using "PyMac_SetConsoleHandler" to suppress the SIOUX console, and
I've created my own write handler that captures Python's stdout &
stderr and redirects them into my C code. So far no problem.

Now I'd like to do the same for stdin, reading lines from a buffer in
my C code and passing them to sys.stdin in my Python code.
Unfortunately, the only thing I've found that works so far is to write
the data to temp file in C and then read it out from Python. But
that's a not much of solution, is it?

Any advice/pointers/tips/suggestions would be greatly appreciated.

Thanks

Bill




More information about the Python-list mailing list