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


Groups > comp.lang.python > #109767 > unrolled thread

Re: [Q] ImportError by __import__() on Python >= 3.4

Started byMakoto Kuwata <kwa@kuwata-lab.com>
First post2016-06-10 08:33 +0900
Last post2016-06-10 08:33 +0900
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [Q] ImportError by __import__() on Python >= 3.4 Makoto Kuwata <kwa@kuwata-lab.com> - 2016-06-10 08:33 +0900

#109767 — Re: [Q] ImportError by __import__() on Python >= 3.4

FromMakoto Kuwata <kwa@kuwata-lab.com>
Date2016-06-10 08:33 +0900
SubjectRe: [Q] ImportError by __import__() on Python >= 3.4
Message-ID<mailman.128.1465515187.2306.python-list@python.org>
On Wed, Jun 8, 2016 at 10:24 PM, Michael Selik <michael.selik@gmail.com>
wrote:

> By the way, why choose to write, import, and delete modules? I'd think
> exec'ing code would be sufficient.
>
>
In order to test my own framework for web application.
It loads controller classes lazily. In other words, it loads python module
only when it is required.

For example:

    mappings = [
        (r'/api/hello',   'myapp1.api.hello.Hello'),    #
myapp1/api/hello.py will be loaded lazily
    ]
    app = WSGIApplication(mappings)


In order to test this framework, it is necessary to create and load python
module file dynamically.

--
regars,
makoto

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web