> > If you remove this, you won't be able to get a directory listing of > > directories. I tried this with and without the line; with that line > > in, it gives a directlry listing, without it gives an IOError (Not a > > regular file): > > > >>>>urllib.urlretrieve("ftp://ftp.python.org/pub", "xyzzy") > > > > So I'd be against deleting this, unless there's a different way to get > > directory listings. > > Try it again but with a trailing slash on the address. With the line > removed it will fetch the directory. Otherwise it errors out. The code > apparently tries to get the file and when it fails with a 550 (meaning > the file cannot be accessed because of permissions or lack of > existence), the code then send a LIST command which lists whatever the > argument is, file or directory. > > Unfortunately I can't think of a good way to detect the difference > between a file and a directory that just doesn't have the ending slash > beyond reading the output and seeing if it is a single listing for a > file with the same name as the LIST request. 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. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4