Python's import: why doesn't it work?

Gerhard Häring gerhard.haering at gmx.de
Sun Sep 29 13:17:41 EDT 2002


* Mahesh Padmanabhan <news at nospam.eml.cc> [2002-09-29 16:55 +0000]:
> You need to create an empty file called __init__.py inside the
> template directory and call the blah.py script as follows:
> 
> import template.blah

It's also highly recommended to start Python with "python -vv", then
trying to import the module in question. This will show you where Python
tries to find the module.

Btw. sys.modules contains the module search path.

-- Gerhard




More information about the Python-list mailing list