Python site-packages and import

Jorge Godoy godoy at ieee.org
Fri Apr 29 07:38:49 EDT 2005


theoryboy at my-deja.com (Peter Saffrey) writes:

> pzs at bonnie:~$ ls /usr/lib/python2.3/site-packages/id3       
> ID3.py  ID3.pyc  ID3.pyo
> 
> >>> import id3.ID3
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> ImportError: No module named id3.ID3
> >>> 

It is missing a file named "__init__.py" at
/usr/lib/python2.3/site-packages/id3 

Without it Python won't consider "import id3" as valid (and consequently won't
import submodules as well). 

Just 'touch' the file and try again.

-- 
Jorge Godoy      <godoy at ieee.org>



More information about the Python-list mailing list