[issue36056] importlib does not support pathlib

Berker Peksag report at bugs.python.org
Wed Feb 20 14:13:46 EST 2019


Berker Peksag <berker.peksag at gmail.com> added the comment:

Thanks for the report, but importlib.import_module() doesn't accept a path of a Python module:

    https://docs.python.org/3/library/importlib.html#importlib.import_module

So, the correct way to use the API is:

    import importlib
    importlib.import_module('poc')

Whether we should explicitly reject passing a file path to import_module() is up to the importlib maintainers.

----------
nosy: +berker.peksag, brett.cannon -remi.lapeyre
resolution:  -> not a bug
stage:  -> resolved
status: open -> pending
type:  -> enhancement
versions:  -Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36056>
_______________________________________


More information about the Python-bugs-list mailing list