Why Is Paramiko Raising Eoferror() When The Sftp Object Is Stored In A Dictionary?
I'm having trouble with an application I'm writing that downloads and uploads files to and from other boxes via SSH. The issue I'm experiencing is that I can get (download) files j
Solution 1:
I was able to resolve my issue. I was supposed to be using Paramiko.Transport and then creating the SFTPClient
with paramiko.SFTPClient.from_transport(t)
instead of using open_sftp()
from SSHClient()
.
The following code works:
t = paramiko.Transport((host, 22))
t.connect(username=username, password=password)
sftp = paramiko.SFTPClient.from_transport(t)
Solution 2:
as i see it, with ssh=SSHClient() you create an SSHClient-Object, and then with sftp=ssh.open_sftp() you create an sftp-object. while you only want to use the sftp, you store the ssh in a local variable, which then gets gc'd, but, if the ssh is gc'd, the sftp magically stops working. don't know why, but try to store the ssh for the time your sftp lives.
Solution 3:
After reading your edit I think the problem is here
stdin, stdout, stderr = self.sshConnections[host].exec_command(command)
this line apparently disconnect the ftp thing
EDITED
Post a Comment for "Why Is Paramiko Raising Eoferror() When The Sftp Object Is Stored In A Dictionary?"