Howto Launch a windows application ?
yuxi at gatech.edu
Thu Oct 4 00:53:07 CEST 2007
stef mientki wrote:
> 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' )
Your problem is probably the last line there with the '>'. That's an
output redirection that is done not by jalv2_3.exe but by the command
shell. That's why it works only with the batch file (which is
interpreted by the command shell.
Using a batch file is probably easiest for this. But I'm guessing you
probably want to change the command line arguments passed to the program
that's why you prefer to build the command line manually.
In that case, there are a few solutions:
1) Generate the batch file programmatically.
2) Use cmd.exe /C (assuming you're on Windows XP). So your program would
be something like:
cmd.append('"D:\\PIC-tools\\JALxxx\\jalv2_3.exe -long-start -d -clear
(or something like that)
3) Do the redirection yourself. Remove the line:
cmd.append ('>d:\\data_actueel\\d7_test_browser\\temp.log' )
and instead read the results directly from the Popen.stdout. You can
then write the output to a file if you want.
More information about the Python-list