Yu-Xi Lim wrote: > 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. > > No that's not the problem, leaving the redirection away, gives the same problems.
> Using a batch file is probably easiest for this. I think indeed that's he simplest solution. Still wonder why launching a windows program is "so difficult" in python ;-) thanks, Stef Mientki > 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('cmd.exe') > cmd.append('/C') > cmd.append('"D:\\PIC-tools\\JALxxx\\jalv2_3.exe -long-start -d -clear > -sD:\\PIC-tools\\JAL\\libs2 > d:\\pic-tools\\jal\\programs\\test_rs232\\test_rs232_hw.jal > >d:\\data_actueel\\d7_test_browser\\temp.log"') > (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. > -- http://mail.python.org/mailman/listinfo/python-list