python import error

Michael Torrie torriem at
Wed Dec 11 05:25:50 CET 2013

On 12/10/2013 08:56 PM, smilesonisamal at wrote:
> Traceback (most recent call last):
>   File "", line 5, in <module>
>     from ccc.ddd import sss
> ImportError: No module named ccc.ddd
> directory structure as follows:
> ccc
> |
>  ddd
>    |

This is because directories have no inherent meaning to python.  A
module is normally a file.  If you want to group a bunch of files
together you have to use a package. See the docs on how to make a
package.  But the namespace structure within a package isn't based on
the directory tree either.  It's usually set up by within
the package which imports modules defined in the package into the

Hope this helps.

More information about the Python-list mailing list