Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91138
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <doug.garstang@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'works.': 0.07; 'imported': 0.09; 'imports': 0.09; 'namespace': 0.09; 'subject:module': 0.09; 'doug.': 0.16; 'redundant.': 0.16; 'subject:sub': 0.16; 'webapp': 0.16; 'thanks,': 0.19; 'load': 0.20; 'all,': 0.20; 'to:name :python-list@python.org': 0.20; 'work,': 0.21; 'trying': 0.22; 'suppose': 0.22; 'bit': 0.23; 'module': 0.23; 'import': 0.24; 'message-id:@mail.gmail.com': 0.28; 'options': 0.28; "i'm": 0.29; 'appear': 0.29; 'piece': 0.29; '(which': 0.29; "skip:' 10": 0.30; "i'd": 0.31; 'skip:s 30': 0.31; 'common': 0.33; 'combination': 0.33; 'case,': 0.34; 'received:google.com': 0.34; 'to:addr:python- list': 0.35; 'step': 0.36; 'modules': 0.36; 'statement': 0.36; 'someone': 0.38; 'space': 0.38; 'to:addr:python.org': 0.39; 'well.': 0.40; 'subject:with': 0.40; 'called': 0.40; 'further': 0.60; 'url:info': 0.71; 'subject:Import': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=wRY7xNCjpF4XKMbNqmh4aV/mCQR5HZ3mrBOTMlGEz2Q=; b=ozWcEeIe8sHlddYlIRuCKnU8nuJ9+/B2o5SE90PccIuB84oD0Sk3UhFdfegzkR46ZT ZqKzQl9oUe2N38c0szsrDdbEaRfFU5oUEcABGPdZcwb+ZtW08KJna36OB+6FkuJNhonm MIDjkF8PrhauIM3ebg2384zzAZ2IMt3PkZos/jyeszQSeR0V06QHUmAzN1inkVL147Cg 7/HDV3vZE32g5e44fl5lHxSiVMGuGi9fBJnmJy/JObdZw4aPM4fO1+8n/3SNGUptfNqN fbL7qvXDmDbRESYmUSGXUaI1n5m5RLbMA5ss5qU9fbVe+Mgu3f4sJDfLfSmc9NShPSBI Cgwg== |
| MIME-Version | 1.0 |
| X-Received | by 10.153.11.163 with SMTP id ej3mr10826757lad.105.1432396999844; Sat, 23 May 2015 09:03:19 -0700 (PDT) |
| Date | Sat, 23 May 2015 09:03:19 -0700 |
| Subject | Dynamic Import with sub module |
| From | Douglas Garstang <doug.garstang@gmail.com> |
| To | "python-list@python.org" <python-list@python.org> |
| Content-Type | multipart/alternative; boundary=001a1134635a5a6c490516c1ea1d |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.281.1432397354.17265.python-list@python.org> (permalink) |
| Lines | 55 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1432397354 news.xs4all.nl 2852 [2001:888:2000:d::a6]:55557 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:91138 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
All, Can someone tell me how the following statement: import slice_fablib_common.common as common would be replicated with __import__ or import_module? I'm using fabric and I want the module when imported to appear in the namespace (which fabric shows as a task), in this case, as 'common.chef'. With the import statement it works. However, I'm trying to load the modules dynamically, and I just cannot work out what combination of options when used with dynamic imports will get me to 'common.chef'. When I get that to work, I'd like to go one step further as well. If I have modules called slice_fablib_webapp.webapp.deploy and slice_fablib_webapp.webapp.info, I'd like to import them as webapp.deploy and webapp.info. I suppose the webapp piece is a bit redundant. If I removed it, and ended up with slice_fablib_webapp.deploy and slice_fablib_webapp.info, I'd like to import them so that they still appear in fabric's name space as webapp.deploy and webapp.info. Thanks, Doug.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Dynamic Import with sub module Douglas Garstang <doug.garstang@gmail.com> - 2015-05-23 09:03 -0700
csiph-web