newbie question: how to get directory of script?

Tom McDermott spon at cisco.com
Tue Nov 12 21:18:05 EST 2002


djw wrote:
> 
> os.getcwd()
> 
No such luck. This (at least on linux) returns the directory from which
the script is invoked, rather than the directory of the script.

I use sys.path[0], but that doesn't seem to be the official method.

Tom



More information about the Python-list mailing list