1

I am new to programming .I am writing a python code to copy a file to a server and unzip it . Here is my code

import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())

client.connect('ipaddr', username='admin',password='password')
print ("copying")
sftp = client.open_sftp()
sftp.put('/home/app/workspace/vd.zip', '/home/admin/workspace/vd.zip')
sftp.close()
stdin, stdout, stderr = client.exec_command("unzip vd.zip")

~ The file gets copied but the unzip commnd doesnot gets executed . it shows the following error

Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/paramiko/file.py", line 66, in __del__
  File "/usr/local/lib/python3.6/dist-packages/paramiko/channel.py", line 1392, in close
  File "/usr/local/lib/python3.6/dist-packages/paramiko/channel.py", line 991, in shutdown_write
  File "/usr/local/lib/python3.6/dist-packages/paramiko/channel.py", line 963, in shutdown
  File "/usr/local/lib/python3.6/dist-packages/paramiko/channel.py", line 1246, in _send_eof
  File "/usr/local/lib/python3.6/dist-packages/paramiko/message.py", line 232, in add_int
TypeError: 'NoneType' object is not callable

Please help .Thanks in advance

0 Answers0