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


Groups > comp.lang.python > #8824

Re: imp.find_module don't found my module but standard import statement can import this module… why ?

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.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.007
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:module': 0.04; 'function:': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:don': 0.09; 'am,': 0.13; 'wrote:': 0.15; 'pypi.': 0.16; 'stephane': 0.16; 'subject:import': 0.16; '\xe9crit': 0.16; 'blog:': 0.22; 'header:In-Reply-To:1': 0.22; 'tue,': 0.23; 'import': 0.29; 'module': 0.30; 'thanks': 0.31; 'hi,': 0.31; 'to:addr:python-list': 0.34; 'header:X-Complaints-To:1': 0.34; 'header:User-Agent:1': 0.34; 'subject: ?': 0.35; 'some': 0.37; 'received:org': 0.38; 'subject:can': 0.38; 'subject:: ': 0.38; 'eric': 0.38; 'header:Mime-Version:1': 0.39; 'to:addr:python.org': 0.39; 'subject:but': 0.67; 'subject:this': 0.74; 'url:info': 0.75; 'from:charset:windows-1252': 0.84; 'snow': 0.91; 'subject:found': 0.91; 'klein': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Stéphane Klein <stephane@harobed.org>
Subject Re: imp.find_module don't found my module but standard import statement can import this module… why ?
Date Tue, 05 Jul 2011 15:47:11 +0200
References <iuueur$7j9$1@dough.gmane.org> <CALFfu7CCs+ErMwq8LA+5FHBbU3TiXb91gxGYS2-fnGg=rOrM5g@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 8bit
X-Gmane-NNTP-Posting-Host pda57-1-82-231-115-1.fbx.proxad.net
User-Agent Mozilla/5.0 (X11; Linux i686; rv:5.0) Gecko/20110627 Thunderbird/5.0
In-Reply-To <CALFfu7CCs+ErMwq8LA+5FHBbU3TiXb91gxGYS2-fnGg=rOrM5g@mail.gmail.com>
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.627.1309873646.1164.python-list@python.org> (permalink)
Lines 29
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1309873646 news.xs4all.nl 21793 [2001:888:2000:d::a6]:56202
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:8824

Show key headers only | View raw


Le 05/07/2011 15:44, Eric Snow a écrit :
> On Tue, Jul 5, 2011 at 1:36 AM, Stéphane Klein<stephane@harobed.org>  wrote:
>> Hi,
>>
>> I would like import some module dynamically.
>>
>
> To import a module dynamically, you can use the built-in __import__ function:
>
>    module = __import__("js")
>
> Even better, use importlib's import_module, which is available in
> 2.7/3.2.  A backport is available on PyPI.
>
>    module = importlib.import_module("js")
>

Thanks !

It's work very well.

Regards,
Stephane
-- 
Stéphane Klein <stephane@harobed.org>
blog: http://stephane-klein.info
Twitter: http://twitter.com/klein_stephane
pro: http://www.is-webdesign.com

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


Thread

Re: imp.find_module don't found my module but standard import statement can import this module… why ? Stéphane Klein <stephane@harobed.org> - 2011-07-05 15:47 +0200

csiph-web