Communication between two programs on unix

Mike Meyer mwm at mired.org
Wed Jan 22 12:55:57 EST 2003


[Formatting fixed.]

morden <morden at shadows.net> writes:

> I want to connect the standard output of the tkinter app to the
> stdin of the motif app to return results and connect stdout of motif
> app to the input of the tkinter app. Is that doable? I suppose this
> is what os.popen will do. Right?

Yes, it's doable. No, that's not what os.popen does. popen returns a
file object that communications with the standard input OR ouput of
the command, but not both.

To get both, you want to use popen2, or maybe popen3 or popen4,
depending on what should happen to standard error.

> Scenario #1: I run my tkinter program with no flags and it
> 	popens motif app it should communicate with
> 
> Scenario #2: I connect to a remote system using 'cu' from uucp package
> 	and run a unix app there communicating to my tkinter app spawned
> 	with ~+ sequence in cu (that's what you use to run rz/sz over
> cu session, right?)
> 
>
> Scenario #3: I use ssh to get into a remote system and run a unix
> app there. I have the following question about this scenario: How
> would I connect input of the tkinter program to the output of the
> motif app and vice versa in this case? Is there any way to tell ssh
> client to do this or I would have to modify my apps to have support
> for ssl/tls?

Others have suggested netcat. You can use that and ssh port forwarding
to do this.

This all seems incredibly kludgy. You want to tell us why you want
this, and possibly we can come up with a better all-around solution?

        <mike
-- 
Mike Meyer <mwm at mired.org>			http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.




More information about the Python-list mailing list