I finally found out what was wrong: 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 > subprocess performs double quoting (necessary for paths with spaces) automatically. Therefor both the following lines: cmd.append ( '-sD:\\PIC-tools\\JAL\\libs2' ) cmd.append ( '>d:\\data_actueel\\d7_test_browser\\temp.log' ) should become cmd.append ( '-s' ) cmd.append ( ' D:\\PIC-tools\\JAL\\libs2' ) cmd.append ( '>' ) cmd.append ( 'd:\\data_actueel\\d7_test_browser\\temp.log' ) then everything works perfect, also with the convenience call "call" and the redirection.
thank you all for the hints, cheers, Stef Mientki -- http://mail.python.org/mailman/listinfo/python-list