Path: csiph.com!usenet.pasdenom.info!dedibox.gegeweb.org!gegeweb.eu!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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; 'subject:Python': 0.06; 'python3': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'gui': 0.12; "'__doc__',": 0.16; "'__file__',": 0.16; '-tkc': 0.16; 'finds': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'instance:': 0.16; 'reusable': 0.16; 'subject: \n ': 0.16; 'subject:dependencies': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'library': 0.18; 'module': 0.19; 'widget': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'module,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; "skip:' 10": 0.31; 'subject:the': 0.34; 'johnson': 0.35; 'no,': 0.35; 'test': 0.35; 'version': 0.36; 'module.': 0.36; 'charset:us- ascii': 0.36; 'received:10': 0.37; 'skip:[ 10': 0.38; 'skip:p 20': 0.39; 'subject:"': 0.60; 'name': 0.63; 'to:addr:gmail.com': 0.65; 'subject:history': 0.84; 'rick': 0.93 X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-Sender-Id: wwwh|x-authuser|tim@thechases.com X-MC-Relay: Neutral X-MailChannels-SenderId: wwwh|x-authuser|tim@thechases.com X-MailChannels-Auth-Id: wwwh X-MC-Loop-Signature: 1416565430599:3025196346 X-MC-Ingress-Time: 1416565430599 Date: Fri, 21 Nov 2014 04:26:27 -0600 From: Tim Chase To: Rick Johnson Subject: Re: PyWart: "Python's import statement and the history of external dependencies" In-Reply-To: <8661e407-4472-4208-97c2-f666f6502c67@googlegroups.com> References: <066c46c8-a04d-4489-b15a-b603c1b1818b@googlegroups.com> <8661e407-4472-4208-97c2-f666f6502c67@googlegroups.com> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AuthUser: tim@thechases.com Cc: python-list@python.org 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1416565776 news.xs4all.nl 2944 [2001:888:2000:d::a6]:48200 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:81191 On 2014-11-20 19:53, Rick Johnson wrote: > FOR INSTANCE: Let's say i write a module that presents a > reusable GUI calendar widget, and then i name the module > "calender.py". > > Then Later, when i try to import *MY* GUI widget named > "calendar", i will not get *MY* calendar widget, no, i will > get the Python calendar module. > > The reason Python finds the library module instead of my > module is because the Python library is higher in search > path than my module. What messed-up version of Python are you running? Or did you fail to test your conjecture? $ cat > calendar.py print("This is my local calendar.py") x=1 $ cat > importtest.py import calendar print(dir(calendar)) $ python2 importtest.py This is my local calendar.py ['__builtins__', '__doc__', '__file__', '__name__', '__package__', 'x'] $ python3 importtest.py This is my local calendar.py ['__builtins__', '__cached__', '__doc__', '__file__', '__name__', '__package__', 'x'] It finds my local module, not the system "calendar" module. -tkc