Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.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.007 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'received:134': 0.05; 'importerror:': 0.07; 'skip:/ 40': 0.07; 'python': 0.08; '-name': 0.16; '/dev/null': 0.16; 'skip:/ 50': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; '>>>': 0.18; 'file,': 0.19; 'seems': 0.20; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'figure': 0.23; 'debian': 0.23; "shouldn't": 0.23; 'though.': 0.23; 'import': 0.27; 'depends': 0.28; 'problem': 0.29; 'pm,': 0.29; 'turned': 0.30; 'seem': 0.30; 'imported': 0.30; "i'll": 0.31; "can't": 0.32; 'header:User-Agent:1': 0.33; 'there': 0.33; 'to:addr:python-list': 0.34; 'causing': 0.34; 'file.': 0.34; 'changing': 0.35; 'rest': 0.35; 'file': 0.36; 'problem.': 0.36; 'two': 0.37; 'but': 0.37; 'could': 0.37; 'using': 0.38; 'files': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'details,': 0.74; 'otten': 0.84; 'pardon': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Au8NACenDU+GuA9G/2dsb2JhbABCh2ineQEBBThAEQsYCRYPCQMCAQIBRRMIAr9Mg32FBIMcBJUMhT6Mfw Date: Wed, 11 Jan 2012 16:14:57 +0100 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Icedove/3.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: import problems. References: <4F0D8CF5.1090508@rece.vub.ac.be> <4F0DA090.7080601@rece.vub.ac.be> In-Reply-To: <4F0DA090.7080601@rece.vub.ac.be> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 40 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1326294899 news.xs4all.nl 6955 [2001:888:2000:d::a6]:32851 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:18832 On 01/11/2012 03:45 PM, Antoon Pardon wrote: > On 01/11/2012 02:57 PM, Peter Otten wrote: >> Antoon Pardon wrote: >> >>> I have an import problem I can't figure out. >>> I am using python 2.6.6 on a debian box >>> >>> In one directory (pylib) I have a file misc.py and >>> the file testutil.py. >>> from misc import Rec >>> ImportError: cannot import name Rec >>> >>> Why can I import Rec from misc in testutil when I call testutil.py >>> directly but not when testutil was imported itself? >> Without looking into the details, could it be that you have two misc.py >> files one with and one without Rec > Well that depends on what you mean with "have". This is what > turned up when I searched for "misc.py" > > $ find /usr/local/lib /usr/lib /local/home/apardon -name misc.py > -print 2> /dev/null > /usr/lib/python2.6/compiler/misc.py > /usr/lib/pymodules/python2.6/PyQt4/uic/Compiler/misc.py > /usr/lib/pymodules/python2.6/numpy/oldnumeric/misc.py > /usr/lib/pymodules/python2.6/docutils/transforms/misc.py > /usr/lib/pymodules/python2.6/docutils/parsers/rst/directives/misc.py > /local/home/apardon/src/projecten/pylib/misc.py > > That last one is my file, the rest doesn't seem to be in sys.path so > they shouldn't interfere > as far as I understand. Changing the name of my file to miscutil.py > resolves the problem though. > > I'll see if I can figure out more. It seems there is a directory /usr/lib/pymodules/python2.6/misc in which is an empty __init.py__ file. As far as I understand this makes misc a package on sys.path causing the problem.