Paramiko SSH python -


i´m trying simplest way make ssh connection , execute command paramiko

import paramiko, base64 client = paramiko.sshclient() client.load_system_host_keys() client.connect('10.50.0.150', username='xxxxx', password='xxxxxx') stdin, stdout, stderr = client.exec_command('show performance -type host-io') line in stdout:     print '... ' + line.strip('\n') client.close() 

------------error-----------------------

traceback (most recent call last):   file "a.py", line 5, in <module>     stdin, stdout, stderr = client.exec_command('show performance -type host-io')   file "/usr/lib/python2.6/site-packages/paramiko-1.10.1-py2.6.egg/paramiko/client.py", line 374, in exec_command     chan.exec_command(command)   file "/usr/lib/python2.6/site-packages/paramiko-1.10.1-py2.6.egg/paramiko/channel.py", line 218, in exec_command     self._wait_for_event()   file "/usr/lib/python2.6/site-packages/paramiko-1.10.1-py2.6.egg/paramiko/channel.py", line 1122, in _wait_for_event     raise e eoferror 

if execute code changing command works , computer, command works fine via ssh interative shell.

any idea ?

after client.connect(. . .) need use command

session = client.get_transport().open_session()

then use session.exec_command(. . .).


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -