python executing windows exe

aspineux aspineux at gmail.com
Thu Feb 1 18:25:11 EST 2007


First look if your .exe will accept to work that way !
try in a DOS prompt

> echo yourfilename | nec2d.exe

or if the program expect more input, write them all in a file
( myinputs.txt ) and try :

> nec2d.exe < myinputs.txt

If it works looks for module subprocess and more precisely object
subprocess.popen and method comunicate


On 1 fév, 23:57, "Kiran" <Kiran.Ka... at gmail.com> wrote:
> Hi everybody,
>   I am making python run an executable using the os module.  Here is
> my question.  The executable, once it is running, asks the user to
> input a filename that it will process.  Now, my question is how do i
> automate this.  let me make this clear, it is not an argument you pass
> in when you type in the exe.  An example below illustrates:
>
> THIS IS NOT WHAT YOU DO:
> nec2d.exe couple1.nec                         # couple1.nec is the
> file you want to prcess
>
> rather, what you do is in windows cmd:
>
> nec2d.exe
> **** PROGRAM PRINTS OUT STUFF*****
> **** PROGRAM PRINTS OUT STUFF*****
> **** PROGRAM PRINTS OUT STUFF*****
> **** PROGRAM PRINTS OUT STUFF*****
> Please enter input file:  <--------- THIS IS WHERE THE USER IS ASKED
> TO TYPE IN THE FILENAME
>
> everybody thanks for your help
> -- Kiran





More information about the Python-list mailing list