git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


On Thu, Jun 2, 2016 at 10:06 AM Makoto Kuwata <kwa at 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.