module search path

Martin v. Löwis martin at v.loewis.de
Tue Dec 17 17:21:37 EST 2002


Jive Dadson <dsdfdsadfas at isdfssdfasdf.invalid> writes:

> 1) When I say, "sys.path", I see a long list of files, which are
> approximately the ones I would expect to see.  However, there is no
> OS enviornment variable PYTHONPATH.  Where is Python finding that
> list of files?

It is a complex procedure that also depends on the platform. See
Modules/getpath.c for details (PC/getpathp.c for Windows)

> 2) How can I view the search algorithm?  I want to know things like,
> does it look for a .dll or .pyd before .pyc or .py?

Pass -v to the interpreter to see what modules it imports. On Unix,
use strace to see where it looks.

Regards,
Martin




More information about the Python-list mailing list