[Python-de] import und aktuelles verzeichnis

Dieter Neubauer neubauer at lni.de
Die Nov 23 17:39:32 CET 2004

> Frage: wie kommt yyy.py an das eigene Verzeichnis ???

vielleicht hilft Dir '__file__' ?
also in Deinem Fall 'yyy.__file__'

aus der Python-Ref:

3.2 The standard type hierarchy
Predefined (writable) attributes: __name__ is the module's name; __doc__
is the module's documentation string, or None if unavailable; __file__
is the pathname of the file from which the module was loaded, if it was
loaded from a file. The __file__ attribute is not present for C modules
that are statically linked into the interpreter; for extension modules
loaded dynamically from a shared library, it is the pathname of the
shared library file.