Problem in dealing with timeout and ftplib? (py2.3a2)

Steve Holden sholden at
Wed Feb 26 13:35:14 CET 2003

"Chen" <chenpuqing at> wrote ...
[in response to me saying]
> > Well, truthfully it was probably never a very good idea to go poking
> around
> > in the implementation details of the FTP object. The recommended way to
> get
> > the right timeout using O'Malley's module was to use its
> > "setdefaulttimeout()" function to establish a default timeout far any
> > sockets created without knowledge of the library.
> >
> > Isn't there an equivalent to this in the new socket module?
> >
> Yeah. My current program, written in python-2.2.2 and with the help of
>, works in the way you mentioned.
> The 2.3 version of python provides 'settimeout' and 'gettimeout' methods
> any 'socket' object, so it's possible to re-implement the function without
> But ftplib creates the 'FTP.sock' attribute in
> 'FTP.connect' method. So I can't use the timeout function before the
> connection is established. I think it's a problem of but not
I think it's a bug in the socket module, so I've reported it as SourceForge
bug 693580. There should be no need to ferkle around inside these client
modules and mess with their sockets when there's a perfectly good way of
setting a timeout without doing that. Or at least there should be :-) - the
new module needs setdefaulttimeout().

On a side issue: it's normally considered best to put your reply to a post
*after* what you're responding to. It's a pain for people like me who use MS
OutOfLuck Express, but I try to do it as a courtesy to readers. That way a
single post in the middle of a thread gives the whole story in sequence.

Steve Holden                        
Python Web Programming       
Register for PyCon now!  

More information about the Python-list mailing list