#37 closed defect (fixed)
Confusing behavior of isdir/isfile/islink when a path isn't found
Reported by: | ftputiluser | Owned by: | schwa |
---|---|---|---|
Priority: | major | Milestone: | 2.4.1 |
Component: | Documentation | Version: | |
Keywords: | listdir, isdir, isfile, islink | Cc: |
Description
here an example
In [22]: host=ftputil.FTPHost('ftp.microsoft.com','anonymous','test@test.com') In [23]: lista=host.listdir('/deskapps/games/public/archive_e3/DungeonSiege&FreeLancer/Dungeon Siege') In [24]: lista Out[24]: ['Chris Taylor .doc', 'Dungeon Siege Fact Sheet.doc', 'Logos', 'Screenshots', 'Sketches'] In [25]: for l in lista: ....: print host.path.isdir(l) ....: print host.path.isfile(l) ....: print host.path.islink(l) ....: False False False False False False False False False False False False False False False
maybe the & in the pathname?
regards Nicola
Change History (3)
comment:1 Changed 12 years ago by
Component: | Library → Documentation |
---|---|
Keywords: | listdir isdir isfile islink added |
Resolution: | → fixed |
Status: | new → closed |
comment:2 Changed 12 years ago by
Summary: | Results from listdir are not file,not link and not dir → Confusing behavior of isdir/isfile/islink when a path isn't found |
---|
comment:3 Changed 12 years ago by
Milestone: | → 2.4.1 |
---|
Note: See
TracTickets for help on using
tickets.
You list a remote directory, but you don't change into it and call
is*()
with the relative paths returned bylistdir
. As Python'sos.path.is*()
methods, ftputil's returnFalse
if they can't find a filesystem item with the given name.Probably the documentation should point this pitfall out, which I've also run into in the past. I added something on that to the documentation in changeset 862.