You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Future relies on the imp module in standard_library, used for things like from future.standard_library import hooks. In Python 3.12, the module has been completely removed. Future needs to switch to use importlib.
from future.standard_library import hooks
File "/home/odie5533/test/venv/lib/python3.12/site-packages/future/standard_library/__init__.py", line 65, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
Workaround
If your code is like this
# Python 2 and 3: alternative 2fromfuture.standard_libraryimporthookswithhooks():
fromurllib.parseimporturlparse, urlencodefromurllib.requestimporturlopen, Requestfromurllib.errorimportHTTPError
You can rewrite it using the try-except form in the Cheat Sheet.
# Python 2 and 3: alternative 4try:
fromurllib.parseimporturlparse, urlencodefromurllib.requestimporturlopen, Requestfromurllib.errorimportHTTPErrorexceptImportError:
fromurlparseimporturlparsefromurllibimporturlencodefromurllib2importurlopen, Request, HTTPError
Any chance for a real fix and not just a workaround? I've got a project that uses this as a dependency 2 levels down, causing me to be python 3.12 incompatible.
Activity
odie5533 commentedon Oct 11, 2023
Tried my hand at a PR but I can't dip into another codebase right now and I'm unsure of the state of some of the tests.
amotl commentedon Oct 14, 2023
Thank you for submitting GH-626. We are also running into this over at mqttwarn.
Github workflow: Remove external dependency on python-future
Github workflow: Remove external dependency on python-future
liquidsec commentedon Jan 17, 2024
Any chance for a real fix and not just a workaround? I've got a project that uses this as a dependency 2 levels down, causing me to be python 3.12 incompatible.
richardpenman/whois#188
nsoranzo commentedon Feb 1, 2024
@liquidsec Have a look at #632 .