On Monday 30 April 2007 12:09:10 pm James Paige wrote: > On Sun, Apr 29, 2007 at 05:38:33PM -0400, Jason Coggins wrote: > > I am trying to run them from the desktop by double clicking on them then > > selecting either run or run in terminal from the box that pops up. I > > tried right clicking on the program to select "open with python" but that > > was not an option. When I right clicked and selected "open with another > > application" python was not listed on the application list. I know I > > have python 2.5 installed because it states so on the synamtic package > > manager. > > > > Jason > > I have had a lot of problems with this too. The problem is that most > pygame games assume that that the current working directory has been set > to the directory where the .py file is located. But when you > double-click and pick "run" or right-click and pick "open with python", > the current working directory does NOT get set, and the game cannot find > its data files. > > What I do for my own games is something similar to this: > > import os > import sys > os.chdir(os.path.dirname(sys.argv[0])) > > That makes sure that the data files will always be found where you > expect them. > > --- > James Paige
That's good information. I'll have to remember to make my game do that too!