Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

_convert_status IOError: Failure on sftp.open(remote_file_path, 'r') #1240

Open
SamuelRamond opened this issue Jun 19, 2018 · 0 comments
Open

Comments

@SamuelRamond
Copy link

Hi,
I ran into an issue trying to open a file from a remote SFTP to local, a short version of the code is:

transport = paramiko.Transport((hostname, int(port)))
(...) Config stuff
transport.connect(**transport_config)
sftp = paramiko.SFTPClient.from_transport(transport)
with sftp.open(remote_file_path, 'r') as remote_file:
    shutil.copyfileobj(remote_file, open(local_file_path, 'w'))

This code used to work well for a time, but is failing for a few days. My guess is that the remote file is getting bigger that's why it failed but not sure why. (note that it's only 263mb)

Here is the stack trace, i don't have enough information on what is going on ?

File "/var/www/service-sftp-fetcher/releases/20180612155411/alk_service_exchange/model/fetcher.py", line 82, in fetch
    with sftp.open(remote_file_path, 'r') as remote_file:
  File "/var/www/service-sftp-fetcher/shared/env/local/lib/python2.7/site-packages/paramiko-2.4.1-py2.7.egg/paramiko/sftp_client.py", line 341, in open
    t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
  File "/var/www/service-sftp-fetcher/shared/env/local/lib/python2.7/site-packages/paramiko-2.4.1-py2.7.egg/paramiko/sftp_client.py", line 780, in _request
    return self._read_response(num)
  File "/var/www/service-sftp-fetcher/shared/env/local/lib/python2.7/site-packages/paramiko-2.4.1-py2.7.egg/paramiko/sftp_client.py", line 832, in _read_response
    self._convert_status(msg)
  File "/var/www/service-sftp-fetcher/shared/env/local/lib/python2.7/site-packages/paramiko-2.4.1-py2.7.egg/paramiko/sftp_client.py", line 865, in _convert_status
    raise IOError(text)
IOError: Failure

Note: I'm using this open + copyfileobj as a fallback for a failed

sftp.get(remote_file_path, local_file_path)

cf: #926

I'm using: paramiko-2.4.1 with python 2.7

Thank for your support and for the lib 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant