forrestcupp
Programmer
- Jul 22, 2006
- 25
I am using Python in Ubuntu Linux with pygtk. In my program I use os.getcwd() to get the current working directory to load image files to show in my window. I have no problems when I either run the program from the command line, or if I run it from nautilus. But I made a link to the program in my gnome/applications menu, and when I run from the menu, os.getcwd() doesn't return the directory that the program is in, so it can't find the images. Temporarily I've just made a string variable dir='/home/CORRECT DIRECTORY' and am using that, but that isn't sufficient if I move the program to another directory, or put it on a different computer. Is there a way to make this work.