python import error

John Gordon gordon at panix.com
Wed Dec 11 17:15:57 CET 2013


In <58f7bd2a-ef82-4782-b4fb-db824f9c8e44 at googlegroups.com> smilesonisamal at gmail.com writes:

> > >   File "aaa.py", line 5, in <module>
> > 
> > >     from ccc.ddd import sss
> > 
> > > ImportError: No module named ccc.ddd
> > 
> > > directory structure as follows:
> > 
> > > ccc
> > > |
> > >  ddd
> > >    |
> > >     aaa.py
> > >     sss.py
>
> It is having __init__.py as blank in ccc and ddd directories. But it
> still doesnot work.

What directory are you in when you run your python command?  As written,
your import will only work if you're in the parent directory of ccc (or
that directory is in your PYTHONPATH.)

-- 
John Gordon         Imagine what it must be like for a real medical doctor to
gordon at panix.com    watch 'House', or a real serial killer to watch 'Dexter'.




More information about the Python-list mailing list