path to data files

Alain Ketterlin alain at dpt-info.u-strasbg.fr
Thu Aug 19 08:30:34 EDT 2010


Daniel Fetchinson <fetchinson at googlemail.com> writes:

> If a python module requires a data file to run how would I reference
> this data file in the source in a way that does not depend on whether
> the module is installed system-wide, installed in $HOME/.local or is
> just placed in a directory from where the interpreter is fired up?

sys.path[0] is supposed to contain the script's directory.

-- Alain.



More information about the Python-list mailing list