Where should I put my HTMLgen directory?

Albert Brandl albert.brandl at lindeverlag.at
Wed Jun 14 09:07:19 EDT 2000


>I am trying to install HTMLGen on my machine.
>[...]
>    import HTMLgen
>ImportError: No module named HTMLgen
>
>So obviously I am doing something wrong. I thought that Python traversed the
>Lib diretory recursively to find any modules. But no?
>
>Should I put all the *.py* files in the root of Lib? That seems a bit messy
>to me.

You could either add the HTML directory to your python path:

import sys
sys.path.append("c:\\Program files\\Python\\lib\\HTMLgen")

(make sure to use "\\" instead of "\"), or add empty files
called __init__.py to both the Lib and HTMLgen directory.
If these files are present, it's possible to import HTMLgen
with e.g.

from Lib.HTMLgen import HTMLgen

http://www.python.org/doc/essays/packages.html

explains the package mechanism in more details.

	Have fun!

		Albert



More information about the Python-list mailing list