[Tutor] finding directory of self
ranceh at gmail.com
Tue Mar 29 01:43:19 CEST 2011
I had been doing this under windows:
osname = os.name
pathtocfg = os.path.dirname(sys.argv)
configfileloc = os.path.abspath(pathtocfg)
to set the directory of all subsequent file lookups in a script.
It worked underwindows because the shortcuts have a "Start In"
I need something for Linux use that does not care about a symlink that
would be used to start the script.
The above code finds the directory the symlink is in.
I'm actually not suprised by this, it is what I expected, I just don't
understand how to fix it.
How can I do something similar to this, but find the "real" dir?
Perhaps one of the other sys.argv arguments?
Thanks for your help
More information about the Tutor