Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
stevepiercy opened this issue Dec 25, 2019 · 0 comments · Fixed by #3555
Closed

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

stevepiercy opened this issue Dec 25, 2019 · 0 comments · Fixed by #3555
Milestone

Comments

@stevepiercy
Copy link
Member

Bug Report

Describe the bug
After generating a Pyramid project from the master branch of the pyramid-cookiecutter-starter and running tests, a DeprecationWarning is output:

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

To Reproduce
Run through the steps starting at https://docs.pylonsproject.org/projects/pyramid/en/master/narr/project.html#creating-the-project and end with running tests.

Expected behavior
No deprecation warning.

Additional context
These lines need to be updated:

import imp
from zope.interface import implementer
from pyramid.interfaces import IAssetDescriptor
ignore_types = [imp.C_EXTENSION, imp.C_BUILTIN]
init_names = [
'__init__%s' % x[0]
for x in imp.get_suffixes()
if x[0] and x[2] not in ignore_types
]

I'm not sure how to fix this one. imp.get_suffixes() and imp.C_EXTENSION and imp.C_BUILTIN don't have clear replacements in importlib. I'm guessing it has something to do with importlib.machinery.all_suffixes(), importlib.machinery.EXTENSION_SUFFIXES, or importlib.machinery.SOURCE_SUFFIXES?

@stevepiercy stevepiercy added this to the 2.0 milestone Dec 25, 2019
mmerickel added a commit to mmerickel/pyramid that referenced this issue Dec 26, 2019
mmerickel added a commit to mmerickel/pyramid that referenced this issue Dec 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant