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
EOFErrorwould be raised in
Don't have a script right now, what we did is to first connect to ftp://22.214.171.124 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("126.96.36.199", "anonymous", "firstname.lastname@example.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,
OSErrorwhereas here, in ticket #114, the
readlinecall succeeds and the following check
if not lineraises an
The comment for the
getlinemethod 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_childalready catches several exceptions and the
_available_childis an implementation detail whose exceptions the user shouldn't have to deal with. Therefore, I'll catch
EOFErrorthere in addition to
Fixed in e1b28c362dc9f1cb894bda37e359292ba07fa9a9.