Python 2.6 ftplib has timeout parameter, but how to detect a timeout

Giampaolo Rodola' gnewsg at gmail.com
Wed Dec 30 14:35:52 EST 2009


On 30 Dic, 18:52, MrJean1 <mrje... at gmail.com> wrote:
> Brendan,
>
> The timeout argument of the FTP class (and the connect method) is used
> only to establish the connection to FTP sockets.  If the timeout
> expires, an error called socket.timeout is raised.
>
> AFAIK, the timeout argument does not limit FTP transfers.  To impose a
> time limit on FTP transfers, try using the timelimited function from
> this recipe:
>
>  <http://code.activestate.com/recipes/576780/>
>
> /Jean
>
> On Dec 14, 11:08 am, Brendan <brendandetra... at yahoo.com> wrote:
>
>
>
> > I was quite happy to see that ftplib in Python 2.6 now has a timeout
> > parameter. With large file downloads my script would often hang,
> > presumably from timing out. Now that there is a timeout parameter, how
> > would I detect when a timeout occurs?

Sorry, I forgot about this.
I had also opened a ticket for this, a long time ago:
http://bugs.python.org/issue4814

--- Giampaolo
http://code.google.com/p/pyftpdlib



More information about the Python-list mailing list