[Tutor] How to launch executable from a Python script??

Chris Irish chris.irish at libertydistribution.com
Tue Nov 8 21:32:16 CET 2005


Hello all :)
I made a GUI app with pyGTK that I want to be able to launch a game I've 
downloaded from the pygame website when a button is clicked.  I was able 
to do this on a linux box since the file was a .py file, but I'm not 
sure how to do it on a windows box since the file is an executeable.  On 
linux I did this:

import os
olddir = os.getcwd()               #to keep a reference to the old 
directory to switch games later
os.chdir('spacinVaders-0.1')   #switch to the game's directory
os.spawnlp(os.P_NOWAIT, 'pythonw', 'pythonw', 'play.py')

and it would launch fine.... can someone help me with this??

Thanks in advance..... Chris :P


More information about the Tutor mailing list