Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78860
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!bcyclone01.am1.xlned.com!bcyclone01.am1.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.105 |
| X-Spam-Level | * |
| X-Spam-Evidence | '*H*': 0.79; '*S*': 0.00; 'cpython': 0.05; '*before*': 0.16; 'subject:after': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'implementing': 0.19; 'import': 0.22; 'install': 0.23; 'alternate': 0.24; 'earlier': 0.24; 'versions': 0.24; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; "skip:' 10": 0.31; 'allows': 0.31; 'this.': 0.32; 'subject:the': 0.34; 'could': 0.34; 'problem': 0.35; 'anybody': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'entry': 0.36; 'hi,': 0.36; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'read': 0.60; 'first': 0.61; 'such': 0.63; 'default': 0.69; 'end.': 0.84; 'gelonida': 0.84; 'subject:add': 0.91 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=L+A4XJvBaw7t9Xonnkt6ENFuok8pIdRU9eKWtenu81U=; b=F8EYHWLWn8cShFdsH5I8D2z+kDPVNgZ3tYPp2RZ5jKWX8PJY9hcVCF3JWaUAvFdNRE o8D/MD6w7ONAEpsviilpNrJbSqnVDNRVrHVX0GmLVE5v1jBwb+hMREA7rgsbuyuuDHiN 7IdXv9NCwLfSulw5bz7pw+aNEPEkYWg8SwIYRejMfxYr7x66+cAWbvkwS4U7nNw4Nhb8 KMzTXzBvVatPQufaDgShGfnRGrwaCAeqwXQasiStSN++wR8RdEL5JybujtlRssCUzrZA BnmXkeSV+xvSVwaxOkR6QNXdkv6EJbOFYYjOQfr2Yl3YJ1VqGi40A14ywTgVgvUowKu4 Lokw== |
| X-Received | by 10.50.22.101 with SMTP id c5mr1151398igf.29.1412808285376; Wed, 08 Oct 2014 15:44:45 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <m1353n$dpu$1@ger.gmane.org> |
| References | <m1353n$dpu$1@ger.gmane.org> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Wed, 8 Oct 2014 16:44:04 -0600 |
| Subject | Re: how to add custom importer after the normal imports |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| 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.14697.1412808288.18130.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1412808288 news.xs4all.nl 2898 [2001:888:2000:d::a6]:48539 |
| X-Complaints-To | abuse@xs4all.nl |
| X-Received-Bytes | 3760 |
| X-Received-Body-CRC | 3367177782 |
| Xref | csiph.com comp.lang.python:78860 |
Show key headers only | View raw
On Wed, Oct 8, 2014 at 4:53 AM, Gelonida N <gelonida@gmail.com> wrote: > Hi, > > > I just read about sys.meta_path, which allows to install custom importers > *BEFORE* the default importers. > > However I have a use case where I would like to add a custom importer > *AFTER* all other import methods have failed. > > Does anybody know how to do this. > > One way of implementing this would be to add the default importer as first > entry in sys.meta_path. My only problem is, that I don't know how to create > a 'default-importer', such that I can add it into sys.meta_path As of CPython 3.3 the default importers are already in sys.meta_path, so you could just add your custom importer to the end. If you need to support earlier versions or alternate implementations then this may not be reliable.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: how to add custom importer after the normal imports Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-08 16:44 -0600
csiph-web