question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The imp module is deprecated in favour of importlib;

See original GitHub issue

It seems this line needs to be updated:

https://github.com/flasgger/flasgger/blob/ce98b046cbec2b2eb8c6de6df4b5409c06a8e539/flasgger/utils.py#L5

  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.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:8

github_iconTop GitHub Comments

6reactions
StefanBrandcommented, 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:

https://github.com/flasgger/flasgger/blob/ce98b046cbec2b2eb8c6de6df4b5409c06a8e539/flasgger/utils.py#L568

The imp docs say the following:

<span class="versionmodified deprecated">Deprecated since version 3.3: </span>Use <span class="pre">importlib.util.find_spec()</span> instead unless Python 3.3 compatibility is required, in which case use <span class="pre">importlib.find_loader()</span>. For example usage of the former case, see the <span class="std std-ref">Examples</span> section of the <span class="pre">importlib</span> documentation.

1reaction
mehdies7commented, Dec 21, 2021

I still get this warning on V0.9.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

imp module is deprecated in favour of importlib - Stack Overflow
Open the file with editing privileges named cloudpickle.py which is present at this location \sklearn\externals\joblib\externals\cloudpickle\ ...
Read more >
DeprecationWarning: the imp module is deprecated in favour ...
It seems that there are a total of 10 (6+4) imp+importlib uses. Generally speaking, they're used for 2 objectives: Importing test cases that...
Read more >
imp — Access the import internals — Python 3.11.1 ...
Deprecated since version 3.4, will be removed in version 3.12: The imp module is deprecated in favor of importlib . ... Return the...
Read more >
the imp module is deprecated in favour of importlib : PY-33279
Doctest - DeprecationWarning: the imp module is deprecated in favour of importlib ; Priority, Normal N ; Type, Bug ; State, Duplicate D...
Read more >
the imp module is deprecated in favour of importlib; see the ...
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses import imp I am not sure...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found