calling a .exe from Python

evidentemente.yo evidentemente.yo at gmail.com
Wed Jun 25 03:15:14 EDT 2008


Hey, thank you very much!!!:D

Would it matter if my .exe doesn't return any value? would it return
like an "ok" or something???

On 24 jun, 14:32, Nick Craig-Wood <n... at craig-wood.com> wrote:
> evidentemente.yo <evidentemente... at gmail.com> wrote:
> >  Hi, i am trying to call a .exe from my .py file, i have found the exec
> >  function, but i'm not sure of how to use it:S
>
> >  would it be f.e.:
>
> >  execl (mypath/myfile.exe,myfile,arg1,arg2,...)
>
> >  ????
>
> >  Another question is, when i call my .exe with exec, i understand that
> >  my .py file will stop running, and instead the new process will be
> >  launched instead of it. Is it true?
> >  Is there a way to launch my .exe without finishing my .py file??
>
> >  thank you very much:)
>
> Probably what you want is this...
>
> from subprocess import call
>
> rc = call(["mypath/myfile.exe",arg1,arg2])
>
> rc will contain the exit status
>
> See the subprocess module for more things you can do
>
> --
> Nick Craig-Wood <n... at craig-wood.com> --http://www.craig-wood.com/nick




More information about the Python-list mailing list