Run program from within Python
kyosohma at gmail.com
Wed Aug 6 21:56:53 CEST 2008
On Aug 6, 2:42 pm, frankrentef <frankren... at yahoo.com> wrote:
> Greetings all...
> Newbie to Python... need help with opening a file from within
> Python... see the following code.
> import popen2
> stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1')
> keygen = stdout.read()
> print "The keygen value is: %s" % keygen
> from the command line if I execute "OpenProgram.exe 1 1" a number is
> returned. ("1 1" are required to return the value needed.) Ultimately
> I want to take that number and apply it to another script, but the
> program is not running.
> NEWBIE to Python..
If you're using Python 2.4+, popen2 is deprecated. I recommend reading
up on the subprocess module instead. Here's a couple links:
The first one also explains how to communicate with a process you
More information about the Python-list