[Python-Dev] urllib.urlretrieve() and handling 550 errors when reading from FTP (original) (raw)
Brett C. bac at OCF.Berkeley.EDU
Sun Jul 11 21:08:51 CEST 2004
- Previous message: [Python-Dev] urllib.urlretrieve() and handling 550 errors when reading from FTP
- Next message: [Python-Dev] urllib.urlretrieve() and handling 550 errors when reading from FTP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Guido van Rossum wrote: [SNIP]
Why should I have to use a trailing backslash to get a directory listing? That's not in the FTP standard and probably won't work everywhere.
It's the way the code is written for the FTP wrapper in urllib; has nothing to do with ftp.python.org or FTP. Basically the code checks to see if there is a trailing slash. If it does it assumes it is a directory and thus only requests a listing of the path from the server. Otherwise it tries to get the file. If that get fails (with a 550) it then decides to try getting a listing for the path. If that works it returns that, otherwise it completely fails.
Basically I don't think there is a way to make this work for urllib nicely. If no one has any objections I will just clarify the docs stating that if an attempt to get a file fails on a 550 error (and of course I will say what that means) it will then try a LIST command and if that succeeds that is what is returned. And if you need more fine-grained control then use ftplib.
-Brett
- Previous message: [Python-Dev] urllib.urlretrieve() and handling 550 errors when reading from FTP
- Next message: [Python-Dev] urllib.urlretrieve() and handling 550 errors when reading from FTP
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]