Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #61530

Re: python import error

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <bsk16@case.edu>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.015
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'subject:error': 0.03; 'importerror:': 0.07; 'wednesday,': 0.07; 'received:209.85.219': 0.09; 'python': 0.11; '"python': 0.16; '__init__.py': 0.16; 'script?': 0.16; 'subject:import': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'module': 0.19; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'package.': 0.24; 'header:In-Reply-To:1': 0.27; 'leave': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message- id:@mail.gmail.com': 0.30; 'work.': 0.31; 'writes:': 0.31; 'file': 0.32; 'received:209.85': 0.35; 'december': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'received:209': 0.37; 'follows:': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'blank': 0.60; 'john': 0.61; "you're": 0.61; 'making': 0.63; 'email addr:gmail.com': 0.63; '9:45': 0.84; '2013': 0.98
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=Vd2Ko2vFhIOIT4Ah/Nb/ZhGpDgPyy8aIdjqWSTAx8EQ=; b=aOEtTSGeB1GdBqDJ8pAN2ora/SxQFbZ70et0m2NhKO425JSPVpfPNxRF4JRrfjSJ1H mXWMKoxRpJUMkjGK76qK793OTfshnd/KL3Qka5aZs2ID923hsFnNRZkgZkweKovrnkqY YuF9AMnUCCMLmn/iWvA6W1/SFpskf7c4h4/ydLakBWrK3XacbfdCJMn8wWYH6UKi/lrg Q3hVATTgZM+07RVN1Ere0n/DreyksN8AvmBK5zO0IjOIbGf5b9p4atKeA7zT6nVtPa2Q zI0GNVBBXcZ0Ll6T00qC7r9MQHelNxAC/e3dwFXnzw3+HopHrSQSVGCx5+34riUTRNWE lhyg==
X-Gm-Message-State ALoCoQniyDhPHjgUh1Dvkk6O7h51Qv3FXm5wXXCGSRtrJYZ/fu6n6hz44tZMmeSsq5KSRGYTtyYQS+2YA5McO2cszKNsPAfi7UQ1neBXizLEdrFuVZ8QZBnjhRLZ9Mu5nPCSx2dqqpA5aBzDH6H/NVJEKlxtHcRjWQ==
X-Received by 10.60.103.106 with SMTP id fv10mr7091oeb.44.1386746649786; Tue, 10 Dec 2013 23:24:09 -0800 (PST)
X-Received by 10.60.103.106 with SMTP id fv10mr7088oeb.44.1386746649675; Tue, 10 Dec 2013 23:24:09 -0800 (PST)
MIME-Version 1.0
In-Reply-To <58f7bd2a-ef82-4782-b4fb-db824f9c8e44@googlegroups.com>
References <93405ea9-6faf-4a09-9fd9-ed264e3136e1@googlegroups.com> <l88r4e$mhe$1@reader1.panix.com> <58f7bd2a-ef82-4782-b4fb-db824f9c8e44@googlegroups.com>
From Benjamin Kaplan <benjamin.kaplan@case.edu>
Date Tue, 10 Dec 2013 23:23:49 -0800
Subject Re: python import error
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-Junkmail-Whitelist YES (by domain whitelist at mpv1.tis.cwru.edu)
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3870.1386747033.18130.python-list@python.org> (permalink)
Lines 51
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1386747033 news.xs4all.nl 2888 [2001:888:2000:d::a6]:42753
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:61530

Show key headers only | View raw


On Tue, Dec 10, 2013 at 9:45 PM,  <smilesonisamal@gmail.com> wrote:
> On Wednesday, December 11, 2013 10:23:34 AM UTC+5:30, John Gordon wrote:
>> In <93405ea9-6faf-4a09-9fd9-ed264e3136e1@googlegroups.com> smilesonisamal@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
>>
>>
>>
>> A python file isn't importable unless the directory also contains a file
>>
>> named __init__.py .
>>
>>
>>
>> Try making __init__.py files in the ccc and ddd directories.  If you
>>
>> don't know what to put in them, just leave them blank.
>>
>>
>> It is having __init__.py as blank in ccc and ddd directories. But it still doesnot work.
>> --


What directory are you in when you execute the script? Python doesn't
look up for packages so if you're in ddd and calling "python aaa.py",
Python doesn't know about the ccc package. You'd just import sss, or
add the parent directory of ccc to sys.path.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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