Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
scrapli
#1
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
Larz60+ write Jul-16-2023, 11:40 PM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use BBCode tags on future posts.
Reply
#2
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)?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020