Run program from within Python

giltay at gmail.com giltay at gmail.com
Wed Aug 6 22:16:33 CEST 2008


On Aug 6, 3:42 pm, frankrentef <frankren... at yahoo.com> wrote:
> stdout, stdin = popen2.popen2('c:\test\OpenProgram.exe 1 1')

What Mike said about subprocess.

Also, in regular Python strings, \t means a tab character.  You need
to replace \ with \\ in the programme path ('c:\\test\\OpenProgram.exe
1 1') or use a raw string (r'c:\test\OpenProgram.exe 1 1').  (The r
informs the Python parser that backslashes are to be used veratim, not
as special code.  If you're using Windows, raw strings make for fewer
headaches when dealing with file paths.)

Geoff G-T




More information about the Python-list mailing list