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


Groups > comp.lang.python > #26657

find out whether a module exists (without importing it)

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!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; "'.'": 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'helps.': 0.16; 'message- id:@dough.gmane.org': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:exists': 0.16; 'sys.path': 0.16; 'module': 0.19; 'import': 0.21; "i'd": 0.22; 'somewhere': 0.24; 'tried': 0.25; 'header:User-Agent:1': 0.26; 'necessary.': 0.27; 'header:X-Complaints-To:1': 0.28; 'located': 0.31; "skip:' 20": 0.32; 'could': 0.32; 'to:addr:python-list': 0.33; 'another': 0.33; 'doing': 0.35; 'something': 0.35; 'there': 0.35; 'received:org': 0.36; 'but': 0.36; "didn't": 0.36; 'anything': 0.36; 'subject: (': 0.36; 'possible.': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'containing': 0.61; 'subject:find': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Gelonida N <gelonida@gmail.com>
Subject find out whether a module exists (without importing it)
Date Mon, 06 Aug 2012 22:48:13 +0200
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host unicorn.dungeon.de
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3030.1344286110.4697.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1344286110 news.xs4all.nl 6899 [2001:888:2000:d::a6]:54608
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26657

Show key headers only | View raw


Is this possible.

let's say I'd like to know whether I could import the module
'mypackage.mymodule', meaning,
whther this module is located somewhere in sys.path

i tried to use

imp.find_module(), but
it didn't find any module name containing a '.'

Am I doing anything wrong?

Is there another existing implementation, that helps.

I could do this manually, but this is something I'd just like to do if 
necessary.

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


Thread

find out whether a module exists (without importing it) Gelonida N <gelonida@gmail.com> - 2012-08-06 22:48 +0200
  Re: find out whether a module exists (without importing it) Miki Tebeka <miki.tebeka@gmail.com> - 2012-08-06 14:58 -0700
  Re: find out whether a module exists (without importing it) Miki Tebeka <miki.tebeka@gmail.com> - 2012-08-06 14:58 -0700
    Re: find out whether a module exists (without importing it) Gelonida N <gelonida@gmail.com> - 2012-08-07 00:40 +0200

csiph-web