Michele Petrazzo wrote: > I want to redistribute the library that I create. > I create a project, its setup.py that when launched copy all files into > the "site-packages/library" directory. And here it's all ok. > When I call my library with: > > import library > library.class() > > I want that my library know where are its real path > (site-packages/library/)
you can use the __file__ or __path__ variables to determine this. e.g. # get this module's directory import os prefix = os.path.dirname(__file__) or, inside a package __init__.py file: # get package's main directory prefix = __path__[0] </F> -- http://mail.python.org/mailman/listinfo/python-list