If an upload or download is started whose duration exceeds the timeout
setting of the server, the main FTP session which spawned the child
session will time out even though the upload/download will succeed. That
is, any direct access (that works on the server) to the original
FTPHost
object will result in a traceback.
(problem reported by Henning Hraban Ramm)
The traceback gotten by Henning is
Traceback (most recent call last): File "./ftpsync.py", line 388, in <module> host.rename(sourcepath, host.path.join(root, abgeholtdir, f)) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 746, in rename self._check_inaccessible_login_directory() File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 535, in _check_inaccessible_login_directory self.chdir(presumable_login_dir) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftputil.py", line 587, in chdir ftp_error._try_with_oserror(self._session.cwd, path) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/ftputil-2.4.2-py2.6.egg/ftputil/ftp_error.py", line 146, in _try_with_oserror raise TemporaryError(*exc.args) ftputil.ftp_error.TemporaryError: 421 No Transfer Timeout (300 seconds): closing control connection. Debugging info: ftputil 2.4.2, Python 2.6.4 (darwin)
and he adds:
The mentioned line (
host.rename
) is right after:host.download_if_newer(sourcepath, targetpath, mode='b')
with host being aftputil.FTPHost
In my opinion, this isn't a defect in ftputil because FTP servers are free to let connections time out.
I agree, though, that ftputil's behavior may seem confusing. Some background is provided here.
To make it easier to keep the connection alive, I've added a
keep_alive
method in revision a7ceaef3cab1c453f9729258fcbfc92ecfd7ae8f. Note that this only works on the "main" connection of theFTPHost
instance. It will not help if a child session times out during a file transfer.
as the links to the mailing list are no longer valid, but the information provided is quite good: the original report and the backround