Calling external program from within python

Mike Driscoll kyosohma at gmail.com
Fri Jul 25 09:46:25 EDT 2008


On Jul 25, 7:56 am, Emmanouil Angelakis <angel... at mpifr-bonn.mpg.de>
wrote:
> Hi,
>
> I am tryiong to do something obviously trivial such as:
> I have a c program called "tsys2list" that when it is ran it asks the user to give the value of "tcal" which is a variable. I want to call the  "tsys2list" from within a pyrthon script lets call it "gamma.py" >>>but<<< I want to pass the value of "tcal" to th eprogram automatically and not by interacting with the keyboard.
>
> How do I do that?
>
> thanks i advance!
> manolis

There are probably many ways to do this. I would recommend checking
out the subprocess module and see if it does what you want. Or you
could learn a little Tkinter or wxPython and use that to get the
user's variable. Or you could even do it via the command line using
the "raw_input" command.

http://docs.python.org/lib/module-subprocess.html

Mike



More information about the Python-list mailing list