Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python.': 0.02; 'subject:error': 0.03; 'tree': 0.05; 'importerror:': 0.07; 'namespace': 0.09; '__init__.py': 0.16; 'from:addr:torriem': 0.16; 'from:name:michael torrie': 0.16; 'helps.': 0.16; 'imports': 0.16; "john's": 0.16; 'namespace.': 0.16; 'subject:import': 0.16; 'think.': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; 'normally': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'either.': 0.24; 'package.': 0.24; 'file.': 0.24; 'right.': 0.26; 'defined': 0.27; 'header:In-Reply-To:1': 0.27; 'michael': 0.29; 'usually': 0.31; 'bunch': 0.31; 'file': 0.32; 'quite': 0.32; 'url:python': 0.33; '(most': 0.33; 'advice': 0.35; 'but': 0.35; "didn't": 0.36; 'url:org': 0.36; 'message-id:@gmail.com': 0.38; 'follows:': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'recent': 0.39; 'structure': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'hope': 0.61; 'url:3': 0.61; "you'll": 0.62; 'email addr:gmail.com': 0.63; 'within': 0.65; 'inherent': 0.84 X-Virus-Scanned: amavisd-new at torriefamily.org Date: Tue, 10 Dec 2013 22:02:34 -0700 From: Michael Torrie User-Agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.12) Gecko/20130105 Thunderbird/10.0.12 MIME-Version: 1.0 To: python-list@python.org Subject: Re: python import error References: <93405ea9-6faf-4a09-9fd9-ed264e3136e1@googlegroups.com> <52A7E94E.2010602@gmail.com> In-Reply-To: <52A7E94E.2010602@gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 31 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386738181 news.xs4all.nl 2857 [2001:888:2000:d::a6]:32939 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61527 On 12/10/2013 09:25 PM, Michael Torrie wrote: > On 12/10/2013 08:56 PM, smilesonisamal@gmail.com wrote: >> Traceback (most recent call last): >> File "aaa.py", line 5, in >> 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. > I didn't quite get that right. Follow John's advice on __init.py__ and you'll have what you want I think.