There is an uncaught ftplib EOF exception in _avaliable_child that does not get transformed to standard FTPUtil errors.
File "/usr/lib/python3.6/site-packages/ftputil/host.py", line 523, in download
conditional=False, callback=callback)
File "/usr/lib/python3.6/site-packages/ftputil/file_transfer.py", line 182, in copy_file
source_fobj = source_file.fobj()
File "/usr/lib/python3.6/site-packages/ftputil/file_transfer.py", line 94, in fobj
return self._host.open(self.name, self.mode)
File "/usr/lib/python3.6/site-packages/ftputil/host.py", line 203, in open
host = self._available_child()
File "/usr/lib/python3.6/site-packages/ftputil/host.py", line 167, in _available_child
host._session.pwd()
File "/usr/lib64/python3.6/ftplib.py", line 654, in pwd
resp = self.voidcmd('PWD')
File "/usr/lib64/python3.6/ftplib.py", line 276, in voidcmd
return self.voidresp()
File "/usr/lib64/python3.6/ftplib.py", line 249, in voidresp
resp = self.getresp()
File "/usr/lib64/python3.6/ftplib.py", line 234, in getresp
resp = self.getmultiline()
File "/usr/lib64/python3.6/ftplib.py", line 220, in getmultiline
line = self.getline()
File "/usr/lib64/python3.6/ftplib.py", line 208, in getline
raise EOFError
Thanks for the report! I think I'll look into it on Saturday.
Do you have a small example script to reproduce the problem? I'd like to see why an
EOFError
would be raised inpwd
.
Don't have a script right now, what we did is to first connect to ftp://208.74.245.143 as annonymous.
Then we used fptHost.download to try to download /CompanyManager/Quickbooks? (10).2/MF/C/Program Files (x86)/Common Files/Intuit/Sync?/Sybase10/mlrsa10.dll
That's when this came up.
I tried the following code to reproduce the error:
import ftputil with ftputil.FTPHost("208.74.245.143", "anonymous", "me@here.org") as host: host.download("/CompanyManager/Quickbooks (10).2/MF/C/Program Files (x86)/" "Common Files/Intuit/Sync/Sybase10/mlrsa10.dll", "mlrsa10.dll")
However, in three runs of this code I wasn't able to reproduce the traceback. The download succeeded without any errors.
That said, this error looks somewhat similar to that in ticket #112, although there's a difference. In ticket #112,
self.file.readline
ingetline
raises anOSError
whereas here, in ticket #114, thereadline
call succeeds and the following checkif not line
raises anEOFError
.The comment for the
getline
method is interesting:# Raise EOFError if the connection is closed
I assume the server closed the connection at some point while downloading many files.
Usually, I don't add exception handling code because of an assumption and not even being able to reproduce an error. However,
_available_child
already catches several exceptions and thepwd
call in_available_child
is an implementation detail whose exceptions the user shouldn't have to deal with. Therefore, I'll catchEOFError
there in addition toftplib.error_temp
,ftplib.error_reply
andOSError
.
Fixed in e1b28c362dc9f1cb894bda37e359292ba07fa9a9.