GeezerVison is showing github.com — Importing imp in standard_library raises a PendingDeprecationWarning · Issue #246 · PythonCharmers/python-future
Importing imp in standard_library raises a PendingDeprecationWarning #246DescriptionThe imp package is pending deprecation in favor of importlib as of Python 3.4.
$ python3.5 -Wonce -c "import future.standard_library"
[...]/lib/python3.5/site.py:165: DeprecationWarning: 'U' mode is deprecated
f = open(fullname, "rU")
[...]/lib/python3.5/site-packages/future/standard_library/__init__.py:66: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
The recommended alternative is described here. Reacted by Jon Dufresne and yonran ActivitygGonz commented on Feb 15, 2020 Any hope to get this fixed? Still happening after 3 years. Reacted by Ferdinand Schlatt Reacted by Ferdinand Schlatt and Dooley_labs elderlabs commented on Nov 21, 2021 Assuming no one has plans to fix this? Currently tracking the source of a DeprecationWarning and found this along the way.
Editing in an idea here, but what's the potential cost of importing imp in conditions requiring Python2 only, with a workaround for situations requiring it in Python3? Python 3.12 will drop all support for imp. Given there are several libraries in the wild that actively depend on python-future for the sole purpose of maintaining Py2 support, I'd like to find a fix in as efficient a manner as possible.
I'd work out a solution myself, but I'm not working with python-future directly, but rather as a dependency of python-whois. Working out a solution on my own risks breaking something, as I'm not using python-future directly. Thanks. elderlabs commented on Mar 31, 2023 Greetings again from the future. We're now in the days of Python 3.11, with Python 3.12's release looming ever closer. There is an open PR (#574) from 2019 to close this issue.
Is python-future dead? Once Python 3.12 releases, this project will be left in a forever broken state if not updated.
Please merge the pending PR.
EDIT 2: Updating my previous edit, it would seem the imp module deprecation is still present in 0.18.3. Will this ever be fixed? hugovk commented on May 11, 2023 yonran commented on Oct 11, 2023 For people googling, in python 3.12, importing future.standard_library raises “ModuleNotFoundError: No module named 'imp'”:
ImportError: Failed to import test module: myfile
Traceback (most recent call last):
…
File "myfile.py", line 41, in <module>
from future import standard_library
File "/opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/future/standard_library/__init__.py", line 65, in <module>
import imp
ModuleNotFoundError: No module named 'imp'
In my case, I resolved the error by replacing those imports that need future.standard_library.install_aliases() with six instead (see imports2):
urllib.parse --> six.moves.urllib.parse
urllib.error --> six.moves.urllib.error
urllib.parse -->six.moves.urllib.parse
dbm.ndbm --> six.moves. dbm_ndbm
http.server --> six.BaseHTTPServer, six.CGIHTTPServer, or six.SimpleHTTPServer
tkinter.filedialog --> six.tkinter_tkfiledialog
tkinter.simpledialog --> six.tkinter_simpledialog
xmlrpc.server --> six.xmlrpc_server
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|