Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeder.news-service.com!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; 'subject:module': 0.04; 'importerror:': 0.07; '>>>>': 0.09; 'function:': 0.09; 'statement.': 0.09; 'subject:don': 0.09; 'am,': 0.13; 'wrote:': 0.15; '"import"': 0.16; 'imp': 0.16; 'pypi.': 0.16; 'stephane': 0.16; 'subject:import': 0.16; 'cc:addr:python-list': 0.16; '(most': 0.21; 'cc:2**0': 0.21; 'blog:': 0.22; 'cc:no real name:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'received:209.85.215.46': 0.23; 'received:mail- ew0-f46.google.com': 0.23; 'sfxlen:0': 0.23; 'tue,': 0.23; 'traceback': 0.25; 'url:mailman': 0.27; 'message- id:@mail.gmail.com': 0.28; 'import': 0.29; 'cc:addr:python.org': 0.30; 'module': 0.30; 'hi,': 0.31; 'url:listinfo': 0.32; 'named': 0.32; "can't": 0.34; 'last):': 0.35; 'module.': 0.35; 'subject: ?': 0.35; 'here,': 0.35; 'install': 0.36; 'skip:" 10': 0.36; 'url:python': 0.37; 'some': 0.37; 'but': 0.37; 'received:google.com': 0.38; 'subject:can': 0.38; 'received:209.85': 0.38; 'url:org': 0.38; 'subject:: ': 0.38; 'received:209': 0.40; 'where': 0.40; 'subject:but': 0.67; 'subject:this': 0.74; 'url:info': 0.75; 'to:charset:iso-8859-1': 0.82; 'subject:found': 0.91; 'klein': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=9TrATc21kc4pd9S+wAmz0U7/ij1UHuurKesHTvVonBk=; b=eSoOP4GRYp4gqLyJ5b3csoC8kxjc78y4W422lm3XGGS3kliU6E8D4TEacs1NXsDZ2z btSDAtpk3cbXJHw1+73YGWSE4Wr1uWmp0AIC+la9hFAePLh16t5xZI8RbrTuLMOApRl8 HqYq3IwCTwgQKYSOOhQEj1VaW3EJggJTa02Ac= MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 5 Jul 2011 07:44:00 -0600 Subject: =?windows-1252?Q?Re=3A_imp=2Efind=5Fmodule_don=27t_found_my_module_but_standa?= =?windows-1252?Q?rd_import_statement_can_import_this_module=85_why_=3F?= From: Eric Snow To: =?ISO-8859-1?Q?St=E9phane_Klein?= 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: , Newsgroups: comp.lang.python Message-ID: Lines: 49 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1309873442 news.xs4all.nl 21876 [2001:888:2000:d::a6]:60141 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:8823 On Tue, Jul 5, 2011 at 1:36 AM, St=E9phane Klein wro= te: > Hi, > > I would like import some module dynamically. > To import a module dynamically, you can use the built-in __import__ functio= n: module =3D __import__("js") Even better, use importlib's import_module, which is available in 2.7/3.2. A backport is available on PyPI. module =3D importlib.import_module("js") -eric > First, I install "js.jquery" > > $ pip install js.jquery > > Here, I would like import "js" module. > >>>> import imp >>>> imp.find_module("js") > Traceback (most recent call last): > =A0File "", line 1, in > ImportError: No module named js >>>> import js >>>> > > I can't found module with "imp.find_module" but I can import it with > standard "import" statement. > > Where is my mistake ? > > Regards, > Stephane > -- > St=E9phane Klein > blog: http://stephane-klein.info > Twitter: http://twitter.com/klein_stephane > pro: http://www.is-webdesign.com > > -- > http://mail.python.org/mailman/listinfo/python-list >