Unzip with Paramiko - Python

流过昼夜 提交于 2019-12-01 11:11:32

Your ssh connection may be closed before unzipping is done. I had a similar problem and added stdout.read() after exec_command to force the connection to be open until unzip is done.

I know this is 3 months old, but I think I just fixed a similar issue and decided to contribute.

Try making the following change:

sftp = paramiko.SFTPClient.from_transport(transport)
print "Starting upload"
sftp.put(localpath, remotepath)
sftp.close() #this should block until put finishes
stdin, stdout, stderr =ssh.exec_command("ls /tmp | grep 10_Recommended.zip")
你的好朋友霍格

Using tar replace unzip works for me.

I thought unzip is not pure Linux command.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!