pyutilib icon indicating copy to clipboard operation
pyutilib copied to clipboard

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

Open egbuck opened this issue 5 years ago • 5 comments

It looks like imp module is still used in .../pyutilib/misc/import_file.py on line 11

I noticed this while using pytest, with importing io, sys, & pyomo

Let me know if more details are required - I would put more, but this seems descriptive enough for this small warning.

egbuck avatar Jul 30 '20 18:07 egbuck

imp.find_module() and imp.load_source() - these appear to be the only times imp is used throughout this file, if that helps

egbuck avatar Jul 30 '20 18:07 egbuck

Thanks for reporting this. I'm looking into converting these.

mrmundt avatar Aug 04 '20 22:08 mrmundt

Suggestions can refer to the following suggestions.

https://github.com/PyUtilib/pyutilib/blob/d99406f2af1fb62268c34453a2fbe6bd4a7348f0/pyutilib/misc/import_file.py#L11

../../.local/lib/python3.8/site-packages/pyutilib/misc/import_file.py:11
  /home/timmy/.local/lib/python3.8/site-packages/pyutilib/misc/import_file.py:11: 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

timmy61109 avatar Nov 30 '20 17:11 timmy61109

This issue seems to be still open. pyutilib does not work with Python 3.12 as the imp module has been deprecated.

nehadimri1991 avatar May 01 '24 07:05 nehadimri1991

Any move on this ? There's a PR open to fix it and it still triggers a warning.

didier-viboo avatar Jun 15 '25 13:06 didier-viboo