module and file locations

Stuart Galloway stuart at gallpath.com
Thu Jul 3 08:38:53 EDT 2003


Hi,

I am writing a debugging a Tkinter program.

While debugging I want to run it by pressing F5.
When in use I want to run it by double-clicking (win2000)

The program reads and write to various files which I want to store in 
the same directory (or a sub directory) of the main script.

My question is: How can my program where it lives so I can get the base 
directory?
argv[0]  - will this work debugging if I just import the file?
There is some about finding where a module is.  This seems to return 
readable text that would require parsing rather than just a file name

Thanks,

Stuart





More information about the Python-list mailing list