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

The imp module is deprecated in favour of importlib; #434

Closed
kamyar opened this issue Sep 30, 2020 · 8 comments
Closed

The imp module is deprecated in favour of importlib; #434

kamyar opened this issue Sep 30, 2020 · 8 comments

Comments

@kamyar
Copy link

kamyar commented Sep 30, 2020

It seems this line needs to be updated:

import imp

  File "/usr/local/Cellar/python@3.8/3.8.2/Frameworks/Python.framework/Versions/3.8/lib/python3.8/imp.py", line 31, in <module>
    warnings.warn("the imp module is deprecated in favour of importlib; "
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

produced using: PYTHONWARNINGS=error in a flask project that uses flasgger.

@StefanBrand
Copy link

StefanBrand commented Oct 1, 2020

Using pytest I get:

../usr/local/lib/python3.8/site-packages/flasgger/utils.py:5
  /usr/local/lib/python3.8/site-packages/flasgger/utils.py:5: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp
-- Docs: https://docs.pytest.org/en/stable/warnings.html

Edit: imp is being used in this line:

site_package = imp.find_module(path[0])[1]

The imp docs say the following:

Deprecated since version 3.3: Use importlib.util.find_spec() instead unless Python 3.3 compatibility is required, in which case use importlib.find_loader(). For example usage of the former case, see the Examples section of the importlib documentation.

@saippuakauppias
Copy link

@billyrrr need change only 1 line for fix this

@mehdies7
Copy link

I still get this warning on V0.9.5

@fredsonchaves07
Copy link

@mehdies7
I managed to solve this problem by removing line 5 from the utils.py file from the flassger
import imp

@toan-le-theout
Copy link

Hi @billyrrr

Is the above fix on the latest release? Looks like V0.9.5 still does not have the above fix. Can we have a release with that fix?

@jfuruness
Copy link

It's not fixed currently

@jfuruness
Copy link

@billyrrr

@jfuruness
Copy link

@toan-le-theout For anyone who wants to ignore this error, you can add this line to your requirements.txt file:
git+https://github.com/flasgger/flasgger.git@05e1af4c723c8d975fc37cd88c6af41387dd12e3#egg=flasgger

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

No branches or pull requests

7 participants