Get EXE (made with py2exe) path directory name
Andrei B
andreizilla at gmail.com
Mon Jun 5 21:26:28 EDT 2006
I need to get absolute path name of a file that's in the same dir as
the exe, however the Current Working Directory is changed to somthing
else.
I turn my script into an executable with py2exe, then I create a
shortcut to the EXE on the desktop. I change the "Start In" variable of
the shortcut "C:\somthing_else", so now the currect working directory
of the executable is not the same as the directory where the EXE is
located.
I need to load a file that's in the same directory as the EXE, so I do
the following:
dir = os.path.dirname(sys.argv[0])
filepath = os.path.join(dir, 'server.pkey')
however it doesn't seem to work.
Any idea?
thanks!
More information about the Python-list
mailing list