Closed remram44 closed 12 years ago
It seems that this happens on a server that immediately closes the TCP connection when it is established.
I am not sure what kind of exceptions ftplib can throw, there might be more that we don't currently catch.
This is "kind of fixed" by ab945e3dfa. It appears there is no clear hierarchy for these exceptions so catching them all would be a bother. I catch Exception
instead.
The ftplib source code contains this interesting couple of lines (couple of lines):
# All exceptions (hopefully) that may be raised here and that aren't
# (always) programming errors on our side
all_errors = (Error, IOError, EOFError)
So I guess this should do the trick : except ftplib.all_errors
.
Because there is a special place in hell for people who write except Exception
.
I find except
to be dangerous, but except Exception
is useful. This might do the trick, here it is set to:
(ftplib.Error, IOError, EOFError, ssl.SSLError)
except Exception
will catch any typo you do in the try block and might make debugging a living hell.
Pushed as c94ceedff2.