Question: How to execute an EXE with Python?
NoThanks at ^*^#*&%.com
Wed Aug 28 19:58:25 CEST 2002
I'm new to Python and I wanted to try this so I created a SpawnDos.py
script on my desktop containing only this:
os.execl(r"c:\windows\system32\cmd.exe", "/k", r"dir")
Double clicking on the script acts as described but running it under
PythonWin causes PythonWin to crash. Bad pointer. There was an access
to address 0x00000004.
This is on XP Pro with the ActiveState distribution.
Who, if anyone, would care about this?
In article <3D6BB110.34C7D54D at erols.com>, whrauser at erols.com says...
> 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',
> But, I generally use the spawn series, since I want to return to my
> script after the program runs.
More information about the Python-list