Communication between two programs on unix

morden morden at shadows.net
Wed Jan 22 15:19:50 EST 2003


Mike Meyer wrote:

> [Formatting fixed.]
>
> morden  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.

I don't care about stderr. popen2 will probably do. I found an example
in python cookbook. Thank you.

>
>
> >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?
>       

I want the communication to work over cu session because some of our
customers live in stone age and don't have Internet connection.
So I want to run gui locally and eventually throw out Motif and move
all the gui into Tkinter. For now I'm just moving modal dialogs
into Tkinter.
The reason to dump Motif is because the lib we use on top of it (Zinc 
4.0) seems pretty buggy and Tk is pretty stable compared to it.





More information about the Python-list mailing list