Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #61524
| Date | 2013-12-10 21:25 -0700 |
|---|---|
| From | Michael Torrie <torriem@gmail.com> |
| Subject | Re: python import error |
| References | <93405ea9-6faf-4a09-9fd9-ed264e3136e1@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3867.1386735979.18130.python-list@python.org> (permalink) |
On 12/10/2013 08:56 PM, smilesonisamal@gmail.com wrote: > Traceback (most recent call last): > 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 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 __init__.py within the package which imports modules defined in the package into the namespace. http://docs.python.org/3/tutorial/modules.html#packages Hope this helps.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
python import error smilesonisamal@gmail.com - 2013-12-10 19:56 -0800
Re: python import error Michael Torrie <torriem@gmail.com> - 2013-12-10 21:25 -0700
Re: python import error John Gordon <gordon@panix.com> - 2013-12-11 04:53 +0000
Re: python import error smilesonisamal@gmail.com - 2013-12-10 21:45 -0800
Re: python import error Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-12-10 23:23 -0800
Re: python import error Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-12-11 09:51 +0000
Re: python import error John Gordon <gordon@panix.com> - 2013-12-11 16:15 +0000
Re: python import error Michael Torrie <torriem@gmail.com> - 2013-12-10 22:02 -0700
csiph-web