Posts: 3 Threads: 1 Joined: Apr 2017 Connection to the device is ok. But when im trying to send some commands, i get an error: stdin, stdout, stderr = ssh.exec_command('show ip int brief') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/python3/dist-packages/paramiko/client.py", line 405, in exec_command chan.exec_command(command) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 60, in _check return func(self, *args, **kwds) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 229, in exec_command self._wait_for_event() File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 1086, in _wait_for_event raise e File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1726, in run ptype, m = self.packetizer.read_message() File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 386, in read_message header = self.read_all(self.__block_size_in, check_rekey=True) File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 251, in read_all raise EOFError() EOFError using Python3 with Paramiko Any help? Thanks Posts: 12,117 Threads: 494 Joined: Sep 2016 Nice traceback, where's the code? also, for traceback use error tags. not python tags Posts: 3 Threads: 1 Joined: Apr 2017 Apr-26-2017, 09:35 AM (This post was last modified: Apr-26-2017, 10:42 AM by Larz60+.) thank you for a reply. Im quite new to python so in step by step manner i do this: osboxes@osboxes:~$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >>> ssh.connect('10.35.1.1',username='admin',password='password') >>> stdin,stdout,stderr=\Output: ... ssh.exec_command("show version")
Error: Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/usr/lib/python3/dist-packages/paramiko/client.py", line 405, in exec_command chan.exec_command(command) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 60, in _check return func(self, *args, **kwds) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 229, in exec_command self._wait_for_event() File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 1086, in _wait_for_event raise e File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1726, in run ptype, m = self.packetizer.read_message() File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 386, in read_message header = self.read_all(self.__block_size_in, check_rekey=True) File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 251, in read_all raise EOFError() EOFError >>>
As you see after sending "show version" line im getting an error. Could you explain to me, what you mean in: "for traceback use error tags. not python tags" or where to read about it ? Posts: 3 Threads: 1 Joined: Apr 2017 ok, so here a little bit formated text. Is it right ? Thanks:) osboxes@osboxes:~$ python3 Python 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >>> ssh.connect('10.35.1.1',username='admin',password='password') >>> stdin,stdout,stderr=ssh.exec_command("show version") Error: Traceback (most recent call last): File "<stdin>", line 2, in <module> File "/usr/lib/python3/dist-packages/paramiko/client.py", line 405, in exec_command chan.exec_command(command) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 60, in _check return func(self, *args, **kwds) File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 229, in exec_command self._wait_for_event() File "/usr/lib/python3/dist-packages/paramiko/channel.py", line 1086, in _wait_for_event raise e File "/usr/lib/python3/dist-packages/paramiko/transport.py", line 1726, in run ptype, m = self.packetizer.read_message() File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 386, in read_message header = self.read_all(self.__block_size_in, check_rekey=True) File "/usr/lib/python3/dist-packages/paramiko/packet.py", line 251, in read_all raise EOFError() EOFError |