Question: How to execute an EXE with Python?

Fausto Arinos de A. Barbuto fbarbuto at telusplanet.net
Wed Aug 28 03:11:42 CEST 2002


    
Hi Peter,

    Now it is working: here is the code.

    import os
    os.chdir('c:/fausto/execs')
    os.system('teste.exe')

    That os.system('c:/fausto/execs/teste.exe') doesn't work.

    Thanks to everybody who helped. Much appreciated!

---Fausto


"Peter Hansen" <peter at engcorp.com> wrote in message:
> "Fausto Arinos de A. Barbuto" wrote:
> > 
> > 
> > Hi everybody,
> > 
> >     I need to write a Python script to call and execute a DOS
> >     .EXE application. How do I do that? I know that there is
> >     os.execv(path, args) and similars, but can't get the right
> >     syntax. Suppose I have a C:/Progs/MyProg.EXE binary
> >     that I want to execute. What would then be the correct
> >     command?
> 
> import os
> os.system('c:/progs/myprog.exe')
> 
> might do the trick.
> 
> -Peter




More information about the Python-list mailing list