Question: How to execute an EXE with Python?

walt whrauser at erols.com
Tue Aug 27 19:04:16 CEST 2002


Fausto,

This will keep the dos window open so you can see what is happening.
(Windows 2000)

""" Execute program in cmd window, /k keeps dos window open """
import os
myPy = 'c:/python22/lib/lib-tk/turtle.py'
os.execl('c:/winnt/system32/cmd.exe', '/k', myPy)

# Could specify path to python if necessary
#os.execl('c:/winnt/system32/cmd.exe', '/k', 'c:/python22/python.exe',
myPy)

But, I generally use the spawn series, since I want to return to my
script after the program runs.

Walt




More information about the Python-list mailing list