Jeff Peery wrote: > hello, I created an executable using py2exe and innosetup for windows. I > need to figure out where the user has installed my program so that I can > direct the program to the installation files that it needs to run. I ran > into this problem because I have a file type that my program reads and I > have registered this type in the windows registry so that when this file > type is double clicked my application is launched. when this happens my > program thinks the working directory is the directory where that > registered file was located... not the installation directory where it > should be working in.... needless to say that lots of things go wrong > when my program is launched this way. so I need to tell my program to > set the working directory back to the installation directory... but > where is this?
Try the __file__ variable in your main module; it should have the path to the .py file. os.path.dirname(__file__) will give you the directory. Then use os.chdir() to change the working dir. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor