summaryrefslogtreecommitdiff
path: root/paramiko/sftp_client.py
diff options
context:
space:
mode:
authorTorkil Gustavsen <torkil@gmail.com>2015-07-23 13:22:39 +0200
committerTorkil Gustavsen <torkil@gmail.com>2015-07-23 13:22:39 +0200
commita671dafb8775e585086600a1fddd364def5aeb20 (patch)
tree976bae9c19d1ed195705c96e494f6adf5a5b02af /paramiko/sftp_client.py
parent9c77538747881bb8cb3f6c7b220515cfd6943b92 (diff)
downloadparamiko-a671dafb8775e585086600a1fddd364def5aeb20.tar.gz
prefetch now requires file_size to be passed in as a parameter
Calling stat from inside the prefetch-body has led users to receive IOError: The message [<filename>] is not extractable.
Diffstat (limited to 'paramiko/sftp_client.py')
-rw-r--r--paramiko/sftp_client.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index 89840eaa..e4c3a37d 100644
--- a/paramiko/sftp_client.py
+++ b/paramiko/sftp_client.py
@@ -685,9 +685,10 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
.. versionadded:: 1.10
"""
+ file_size = self.stat(remotepath).st_size
with self.open(remotepath, 'rb') as fr:
- file_size = self.stat(remotepath).st_size
- fr.prefetch()
+ fr.prefetch(file_size)
+
size = 0
while True:
data = fr.read(32768)