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


Groups > comp.lang.python > #109596

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

From Michael Selik <michael.selik@gmail.com>
Newsgroups comp.lang.python
Subject Re: [Q] ImportError by __import__() on Python >= 3.4
Date 2016-06-06 22:28 +0000
Message-ID <mailman.49.1465252093.2306.python-list@python.org> (permalink)
References <CAFTm5Rv+K6KFMt2FXfWfZtn5gAnJtf4XawfijRpO4vcJf73h7g@mail.gmail.com> <CAGgTfkOLNpR29ff3S64f9H=-2EffHq8KZG0CDONFvMB8Luw9bw@mail.gmail.com>

Show all headers | View raw


On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <kwa@kuwata-lab.com> wrote:

> I have a trouble around __import__().
>

The docs for __import__ strongly recommend that you use importlib instead
https://docs.python.org/3.5/library/importlib.html#importlib.import_module

The docs for ``importlib.import_module`` suggest that you use
``invalidate_caches`` if you are importing dynamically generated files.
https://docs.python.org/3.5/library/importlib.html#importlib.invalidate_caches

I think you'll find this fixes your bug.

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


Thread

Re: [Q] ImportError by __import__() on Python >= 3.4 Michael Selik <michael.selik@gmail.com> - 2016-06-06 22:28 +0000

csiph-web