-1

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
Mahdi
  • 967
  • 4
  • 18
  • 34

1 Answers1

0

(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

Raven
  • 31
  • 7
  • it shows me the error: ERROR: Could not find a version that satisfies the requirement collections (from versions: none) ERROR: No matching distribution found for collections – Mahdi Oct 17 '22 at 00:09
  • @Mahdi I realized that collections isn't a package, its something wrong with exscript, ill try debugging. – Raven Oct 17 '22 at 00:13
  • @Mahdi what are you trying to do with exscript exactly? (asking this so i can find an alternative) – Raven Oct 17 '22 at 00:15
  • login to a device and do some configs – Mahdi Oct 17 '22 at 00:16
  • have a look into the documentation and see what you can find. https://exscript.readthedocs.io/en/latest/cli_tutorial.html#introduction – Raven Oct 17 '22 at 00:21
  • it might fix your problem – Raven Oct 17 '22 at 00:21
  • I just removed Callable in Exscript\util\collections.py, and it works. – Mahdi Oct 17 '22 at 00:40