Clueless: piping between 2 non-python processes

Michael Lehmeier m_lehmeier at gmx.de
Sat Oct 25 18:49:32 EDT 2003


On 2003-10-25, John Roth <newsgroups at jhrothjr.com> wrote:
>
> You need an intermediary process in Python. Set it up as a
> thread so that it receives data from A and sends it to B. Then
> you can do whatever you want on exceptional conditions.

I am currently trying to do this and am making progress.

However, I still have a rather simple problem that I just can't solve.

I have a file B.py that looks like this:

import os

while 1 :
   i = sys.stdin.read(10)
      if len(i) == 0 :
            break
	       sys.stdout.write(i)

It is supposed to print whatever it is fed.
When I use the following commands:

Bclass = popen2.Popen3("./B.py", 't')

while 1 :
   Bclass.tochild.write("Hello World")

the process hangs in the Hello World line.
B.py never gets anything.

What's the problem?




More information about the Python-list mailing list