Python Forum
scrapli - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: scrapli (/thread-40353.html)



scrapli - albazi - Jul-15-2023

Greetings all,
I am new to python and trying to implement the following scenario

from scrapli import Scrapli

my_device = {
    "host": "192.168.1.51",
    "auth_username": "root",
    "auth_password": "kurkur1",
    "auth_strict_key": False,
    "platform": "juniper_junos",
}

conn = Scrapli(**my_device)
conn.open()
result = conn.send_command(command="show configuration")
print(result.result)
conn.close()
and it is not working with a lot of output, not where to look as well

Error:
Traceback (most recent call last): File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/transport/plugins/system/ptyprocess.py", line 483, in read s = self.fileobj.read1(size) OSError: [Errno 5] Input/output error During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/transport/plugins/system/transport.py", line 158, in read buf = self.session.read(65535) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/transport/plugins/system/ptyprocess.py", line 488, in read raise EOFError("End Of File (EOF). Exception style platform.") EOFError: End Of File (EOF). Exception style platform. The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/aqeel/automation/venv/script3.py", line 12, in <module> conn.open() File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/driver/base/sync_driver.py", line 105, in open self.on_open(self) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/driver/core/juniper_junos/sync_driver.py", line 25, in junos_on_open conn.acquire_priv(desired_priv=conn.default_desired_privilege_level) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/driver/network/sync_driver.py", line 166, in acquire_priv self._deescalate(current_priv=target_priv) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/driver/network/sync_driver.py", line 134, in _deescalate self.channel.send_input(channel_input=current_priv.deescalate) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/decorators.py", line 216, in decorate return _multiprocessing_timeout( File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/decorators.py", line 113, in _multiprocessing_timeout return future.result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/channel/sync_channel.py", line 481, in send_input buf += self._read_until_prompt() File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/channel/sync_channel.py", line 137, in _read_until_prompt read_buf.write(self.read()) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/channel/sync_channel.py", line 69, in read buf = self.transport.read() File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/decorators.py", line 216, in decorate return _multiprocessing_timeout( File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/decorators.py", line 113, in _multiprocessing_timeout return future.result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 451, in result return self.__get_result() File "/usr/lib/python3.10/concurrent/futures/_base.py", line 403, in __get_result raise self._exception File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) File "/home/aqeel/automation/venv/lib/python3.10/site-packages/scrapli/transport/plugins/system/transport.py", line 165, in read raise ScrapliConnectionError(msg) from exc scrapli.exceptions.ScrapliConnectionError: encountered EOF reading from transport; typically means the device closed the connection



RE: scrapli - deanhystad - Jul-16-2023

According to the error message, 192.168.1.51 is not interested in talking to you.
Error:
scrapli.exceptions.ScrapliConnectionError: encountered EOF reading from transport; typically means the device closed the connection
Do you have access to the device?
Are your sure you selected the correct driver?
Is everything in my_device correct, including the default port (22)?