urllib/ftpwrapper

Oleg Broytmann phd at phd.russ.ru
Fri May 19 04:18:39 EDT 2000


Hello!

On Thu, 18 May 2000, Guido van Rossum wrote:
> Hm...  Tricky...  The voidresp() call is needed in the ftp protocol to
> consume the '226 Transfer complete' message it sends after the
> transfer is complete.  However you will only get that after the
> transfer is indeed complete.  This is what the comment in webchecker
> refers to.

   Ah, well...

> If you don't make the voidresp() call, you can't reuse the open ftp
> connection for something else.  Since urllib tries to cache ftp
> connections, tht would be a bad thing...
> 
> So I believe it's necessary.

   Yes, I see now.

> I presume that your robot is not reading all the data off the
> connection, is that right?  That's probably why it hangs on "almost

   Cannot beleive it's just so simple :( My robot uses urllib.urlretrieve;
and any test program hangs. Just run in python:

fname, headers = urllib.urlretrieve("ftp://starship.python.net/")

   and it hangs :( Almost all FTP URLs will hang, but there are some that
not: ftp://sun.med.ru/ worked (at least for me), there is pretty standard
wu-ftpd running there.

> all" FTP URLs.  The proper fix would be the same as in webchecker --
> read the rest of the data.

   I beleive URLopener.retrieve eats all data...

Oleg.            (All opinions are mine and not of my employer)
---- 
    Oleg Broytmann      Foundation for Effective Policies      phd at phd.russ.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list