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

Chen chenpuqing at 163.net
Wed Feb 26 20:20:59 EST 2003


"Steve Holden" <sholden at holdenweb.com> wrote in message
news:6w27a.106940$zL6.31517 at news2.central.cox.net...
> "Chen" <chenpuqing at 163.net> 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
> > timeoutsocket.py, works in the way you mentioned.
> >
> > The 2.3 version of python provides 'settimeout' and 'gettimeout' methods
> for
> > any 'socket' object, so it's possible to re-implement the function
without
> > timeoutsocket.py. 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 ftplib.py but not
> > socket.py.
> >
> 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.
>
> regards
> --
> Steve Holden                                  http://www.holdenweb.com/
> Python Web Programming                 http://pydish.holdenweb.com/pwp/
> Register for PyCon now!            http://www.python.org/pycon/reg.html
>
>
>

Your idea is right. It avoids modification of ftplib and other client
modules, and solves the problem entirely. Thank you for your concern of my
problem! Wish the function is added soon.

As to the format of my post, you have given me very a good advice also.
Thank you!







More information about the Python-list mailing list