Cannot import Exscript into Python

104 Views Asked by At

I'm using windows 10, and I have a script to SSH to the device and do some configurations:

from Exscript import Account
from Exscript.protocols import SSH2

account = Account("user","password")
conn = SSH2()                       
conn.connect('192.168.200.2')
conn.login(account) 

But I get the following error:

Traceback (most recent call last):
  File "c:\Users\hp\Desktop\password-finder.py", line 2, in <module>
    from Exscript.protocols import SSH2
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\__init__.py", line 34, in <module>
    from .queue import Queue
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\queue.py", line 40, in <module>
    from .util.decorator import get_label
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\util\decorator.py", line 28, in <module>
    from ..protocols.exception import LoginFailure
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\protocols\__init__.py", line 26, in <module>
    from ..util.url import Url
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\util\url.py", line 36, in <module>
    from .collections import OrderedDefaultDict
  File "c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\site-packages\Exscript\util\collections.py", line 9, in <module>
    from collections import OrderedDict, Callable, defaultdict
ImportError: cannot import name 'Callable' from 'collections' (c:\Users\hp\AppData\Local\Programs\Python\Python310\lib\collections\__init__.py)

Update: Not a perfect solution but works for me: remove Callable keyword in line 9 of file Exscript\util\collections.py:

from collections import OrderedDict, Callable, defaultdict

to:

from collections import OrderedDict, defaultdict
1

There are 1 best solutions below

7
On

(I have to make an answer to comment sorry)

do you have collections installed in python? just to check open cmd and type:

pip install collections

if it says: Requirement already satisfied then i will dig deeper and see what I can find

edit: I'm having the same issue, ill try debugging