DIR() Does not work with directory and file names containing SPACEs (' ')

All ftputil calls that call self._session.dir(<dirname>) fail when <dirname> contains space(s). This is attributable to the fact that dir() procedure is using DIR command on the server - which fails returning the list if path contains space(s).

Workaround is to replace use of DIR with the NLST call. NLST works fine with pathname containing space(s).

NOTICE: This behavior occured in one of the earlier releases of 'ftputil'. I am not sure if it still exists.

Valeriy Pogrebitskiy (vpogrebi@iname.com) (unverified)
Assigned to
18 years ago
18 years ago
bug library

schwa (unverified) 18 years ago · edit

The issue you describe was probably fixed in r316. However, that fix only works if the directory you issue the call from is accessible (compare your ticket #10).

So it seems there is still a bug if the login directory isn't accessible and you access a path with spaces in it from the directory. I don't see an easy way to work around this problem combination (see FTPHost._dir in ftputil.py). Regarding NLST, some servers don't seem to support it or in inconsistent ways across servers.

schwa (unverified) 17 years ago · edit

As it turned out in a conversation with Johannes Strömberg, the above-mentioned fix covered only a part of the potential problems. I've checked in changesets 687:695 which should deal with mkdir, remove, rmtree and others, and also improve the support for the _dir method.

Note that the combination of directory names with spaces in them and an inaccessible login directory still doesn't work and probably can't be made to work either. Luckily, this situation should be a rare.

The fix will be in the next release (2.2.2 or 2.3).

Register here or Log in to comment, or comment via email.