Howto Launch a windows application ?

Matimus mccredie at gmail.com
Thu Oct 4 00:41:09 CEST 2007


stef mientki wrote:
> hello,
>
> I'm trying to launch a windows application,
> but as many others on this list, I've some trouble.
> I read some other threads about this topic,
> but sorry, I still don't understand all this (never heard of pipes).
>
> When I use a batch file, I can launch the bat-file from python,
> and the windows application launched from the batchfile is run perfectly.
>
> Now when I try to run the same windows application from Popen or call,
> nothing happens (or at least it's very fast and produces not the
> expected output).
>
> Please enlighten me, preferable in "windows-terminology"  ;-)
>
> thanks,
> Stef Mientki
>
> from subprocess import *
>
> cmd =[]
> cmd.append ( 'D:\\PIC-tools\\JALxxx\\jalv2_3.exe' )
> cmd.append ( '-long-start' )
> cmd.append ( '-d')
> cmd.append ( '-clear' )
> cmd.append ( '-sD:\\PIC-tools\\JAL\\libs2' )
> cmd.append ( 'd:\\pic-tools\\jal\\programs\\test_rs232\\test_rs232_hw.jal' )
> cmd.append ( '>d:\\data_actueel\\d7_test_browser\\temp.log' )
>
> # DOESN'T WORK
> result = call ( cmd )
>
> # Both Popen and call work
> cmd = [ 'd:\\data_actueel\\d7_test_browser\\JALcc.bat' ]
> #output = Popen ( cmd )
> result = call ( cmd )
> print result

My guess is that with the redirect you simple need to set the 'shell'
option to true.

call(cmd, shell=True)

I haven't tested it, but it is worth a try.

Matt




More information about the Python-list mailing list