[Tutor] pipeline - what is it and how do I use it?
mlangford.cs03 at gtalumni.org
Mon Nov 26 02:29:09 CET 2007
On 11/25/07, elis aeris <hunter92383 at gmail.com> wrote:
> I need to keep a bit of python code ready to run at anytime, in the ram, but
> this is what I need to do
You have several options. You can use sockets to talk to a local
program that has opened a server port. You can batch out commands to a
file. You can directly call most likely from whatever other language
you're using. You can do what I have below.
> I am using two languages at the same time, because python doesn't really
> have any effective way of simulating keyboard and mouse events,
I'm sure it does. I think you're talking about...watsup and
dogtail....http://www.tizmoi.net/watsup/intro.html does it for windows
and http://www.redhat.com/magazine/020jun06/features/dogtail/ does it
for GTK apps. There are surely more for other windowing systems. If
you mentioned what windowing system you were on, we could possibly
> but how do I pass information from one code to the other?
If you insist on passing it back and forth, you can either write it
out over the network using the python sockets api and whatever the
other language can do with networking can read it in (or vice versa).
Otherwise, you can write out the data to a file and use that as the
medium between the languages. You can use a scheme such as the
##Shell Script to run your foo program
Foo.sh > /tmp/data1
echo /tmp/data1 > /var/jobs
##Python program (which I've not run, but should work)
while not os.path.isfile("/var/jobs"):
datafile = file("/var/jobs")
More information about the Tutor