knipknap / exscript

A Python module making Telnet and SSH easy
MIT License
367 stars 136 forks source link

ModuleNotFoundError: No module named 'imp' #232

Open SanderWegter opened 1 year ago

SanderWegter commented 1 year ago

Hi,

I've tried to use Exscript with python 3.12 but unfortunately it seems that the imp module was dropped, see https://github.com/python/cpython/issues/98040

Python 3.12.0 (main, Oct  5 2023, 12:40:12) [Clang 15.0.0 (clang-1500.0.40.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Exscript
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/Exscript/__init__.py", line 34, in <module>
    from .queue import Queue
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/Exscript/queue.py", line 40, in <module>
    from .util.decorator import get_label
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/Exscript/util/decorator.py", line 28, in <module>
    from ..protocols.exception import LoginFailure
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/Exscript/protocols/__init__.py", line 26, in <module>
    from ..util.url import Url
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/Exscript/util/url.py", line 27, in <module>
    from future import standard_library
  File "/Users/dev/test_app/.venv/lib/python3.12/site-packages/future/standard_library/__init__.py", line 65, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'
$ pip freeze                                                                                                                                      ─╯
Exscript==2.6.28
oduvan commented 9 months ago

same :(

oduvan commented 9 months ago

looks like the fix for that is to put

from future import standard_library
standard_library.install_aliases()

under condition

if sys.version_info[0] ==2:

or something like that