newbie question: how to get directory of script?

Godefroid Chapelle gotcha at swing.be
Wed Nov 13 03:25:08 EST 2002


> I want to be able to get the path of the script I am running (the idea
> is that I might have a data file or an ini file sitting in the same
> directory as the py file).  

Try the following :

import os.path
the_module_path, the_module_file = os.path.split(the_module.__file__)



More information about the Python-list mailing list