Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'argument': 0.04; "'.'": 0.09; 'hierarchical': 0.09; 'subject:module': 0.09; 'to:addr:comp.lang.python': 0.09; 'url:github': 0.09; 'cc:addr :python-list': 0.10; '"this': 0.13; 'dotted': 0.16; 'from:addr:miki.tebeka': 0.16; 'from:name:miki tebeka': 0.16; 'recipe': 0.16; 'subject:exists': 0.16; 'load': 0.19; 'module': 0.19; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'function': 0.30; 'url:python': 0.32; 'docs': 0.33; 'handle': 0.33; 'received:google.com': 0.34; 'path': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; "didn't": 0.36; 'subject: (': 0.36; 'possible': 0.37; 'itself': 0.37; 'does': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'url:docs': 0.38; 'apply': 0.39; 'containing': 0.61; 'say:': 0.84; 'subject:find': 0.84; 'url:imp': 0.84 Newsgroups: comp.lang.python Date: Mon, 6 Aug 2012 14:58:24 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=75.82.8.111; posting-account=uo-8fwoAAACKsFzFX78JHudx1V7WDXZ0 References: User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 75.82.8.111 MIME-Version: 1.0 Subject: Re: find out whether a module exists (without importing it) From: Miki Tebeka To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: python-list@python.org 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: , Message-ID: Lines: 12 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1344290308 news.xs4all.nl 6858 [2001:888:2000:d::a6]:47546 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26663 > imp.find_module(), but > it didn't find any module name containing a '.' The docs (http://docs.python.org/library/imp.html#imp.find_module) clearly = say: "This function does not handle hierarchical module names (names containing = dots). In order to find P.M, that is, submodule M of package P, use find_mo= dule() and load_module() to find and load package P, and then use find_modu= le() with the path argument set to P.__path__. When P itself has a dotted n= ame, apply this recipe recursively." See https://gist.github.com/3278829 for possible implementation.