Home

dude wrote:
> Working on Windows XP
> Say I have a Windows executable, foo.exe.
> foo.exe is a command line tool that can take a number of different
> arguments and perform corresponding actions.
>
> I want to invoke foo.exe from a Python script (using whatever will
> work best). I want to continuously pass arguments to foo.exe in
> between doing other stuff from within my Python script.
>
> Some pseudo code:
>
> processHandle = invoke("foo.exe") # what python module should "invoke"
> be here?
>
> doUnrelatedStuff()
>
> processHandle.passArgs("arg1 arg2") # The same foo.exe I invoked above
> gets these args for processing
>
> doMoreUnrelatedStuff()
>
> processHandle.passArgs("arg3 arg4") # The same foo.exe I invoked above
> gets these args for processing
>
> processHandle.close() # "foo.exe is destroyed"
>
> Thanks for any help.
>
When you say "pass arguments", the methodology you outline definitely
isn't going to fly with argument passing. When a command is invoked the
arguments are taken from the command line, so it isn't possible to pass
further arguments at a later time.

You probably need to write to you sub-process's standard input stream.
which you can do whit the subprocess module (the modern way to do it) or
one of the various popen() functions.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

previous
next

Re: counting repeated words in input
deselect an iterm in ListBox wxPython
ElementTree surprise
Re: Frustrating bug in C++ program (Code for GUTTED testing version of main program now available)
rel_ops and namespace
forum pokerowe
kolektory słoneczne Łódź
kasyno
Podnośniki
Avon katalog aktualny