[python-win32] regarding ftp api call
Tim Golden
mail at timgolden.me.uk
Thu Sep 24 13:43:45 CEST 2009
a h wrote:
> hi
> thanks for the replies.
> setting socket timeout works fine.
> I also find alternate way that perform the same thing,ie ftp connection
> timeout.
>
> import ftplib
> f = ftplib.FTP("server_host_name", "TIMEOUT")
Thanks for posting back. And I learnt something new: that the
FTP initialiser takes a timeout parameter, so thanks for
educating me. I would point out, tho', that your quick
example above obviously *won't* set the timeout; it will
connect to the server with a username of "TIMEOUT". Hopefully
you knew that and were just jotting quickly, but for any
future readers, the timeout is most easily specified as
a named param to the FTP constructor:
f = ftplib.FTP ("mail.python.org", timeout=2.0)
TJG
More information about the python-win32
mailing list