On 11/25/07, elis aeris <[EMAIL PROTECTED]> 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 help > 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 following: ##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") map(myFileProcessingFunc,datafile.readlines()) datafile.close() os.remove("/var/jobs") -- Michael Langford Phone: 404-386-0495 Consulting: http://www.RowdyLabs.com _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
