How to send a var to stdin of an external software
Benjamin Watine
watine at cines.fr
Fri Mar 14 07:37:50 EDT 2008
Bryan Olson a écrit :
> I wrote:
>> [...] Pipe loops are tricky business.
>>
>> Popular solutions are to make either the input or output stream
>> a disk file, or to create another thread (or process) to be an
>> active reader or writer.
>
> Or asynchronous I/O. On Unix-like systems, you can select() on
> the underlying file descriptors. (MS-Windows async mechanisms are
> not as well exposed by the Python standard library.)
>
Hi Bryan
Thank you so much for your advice. You're right, I just made a test with
a 10 MB input stream, and it hangs exactly like you said (on
cat.stdin.write(myStdin))...
I don't want to use disk files. In reality, this script was previously
done in bash using disk files, but I had problems with that solution
(the files wasn't always cleared, and sometimes, I've found a part of
previous input at the end of the next input.)
That's why I want to use python, just to not use disk files.
Could you give me more information / examples about the two solutions
you've proposed (thread or asynchronous I/O) ?
Thank you !
Ben
More information about the Python-list
mailing list