Skip to content

DeprecationWarning: the imp module is deprecated in favour of importlib #1

Description

@xrobin

Since upgrading from Python 2.7 to 3.6, I am seeing the following deprecation warning about the imp module:

DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

This warning is somewhat annoying and I'd like to get rid of it, however I haven't been able to replace the plugin system with importlib.

The closest I've got so far is [1]:

        import importlib
        module_spec = importlib.machinery.PathFinder().find_spec(addon, [PLUGIN_DIRECTORY])
        module = importlib.util.module_from_spec(module_spec)
        module_spec.loader.exec_module(module)

But that doesn't work:

*** ModuleNotFoundError: No module named 'my_addon'

It would be nice to have an updated version of the framework that works with importlib.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions