Version : ftputil 2.1, python 2.4.1 FTP Server : pureftpd 1.0.21 on Mac OS 10.4.6
When call listdir() on any virtual folder on this server, it always reports a 550 error:
.../ftp_stat.py in _real_listdir(self, path)
327 path = self._path.abspath(path)
328 if not self._path.isdir(path):
--> 329 raise ftp_error.PermanentError(
330 "550 %s: no such directory or wrong directory parser used" %
331 path)
PermanentError: 550 /somedir: no such directory or wrong directory parser used
Debugging info: ftputil 2.1, Python 2.4.1 (darwin)
And also, isdir() returns false for this folder(that causes the PermanentError directly) when islink() returns true.
But chdir() works on these folders, even listdir() works for its subfolders.
I try to debug it and finally I found, the result of "LIST" command looks a little strange on the server:
...
lrwxr-xr-x 1 0 1982 22 Mar 5 02:05 somedir -> /Users/someuser/somedir
drwxr-xr-x 3 1982 1982 102 May 15 03:21 incoming
As you see, the virtual folder links to its absolute path on the server's local file system, not the path on the "ftp file system".
So when _real_stat() is called internal (after calling isdir()), it trys to follow the absolute path "/Users/someuser/somedir" but fails, so all things turn wrong from here.
Could ftputil handle this situation?
Thank you for the bug report.
If
/Users/someuser/somedir
doesn't point to an accessible directory in the file system seen after the FTP login, the behavior of ftputil is IMHO correct. If, on the other hand, the link target worked, as inhost.listdir("/Users/someuser/somedir")
, that would look like an ftputil bug.What do you get when you call
host.listdir("/Users/someuser/somedir")
(the link target)?
If the absolute link target doesn't work, a workaround could be to use a relative link (containing
../...
) that works for both the "normal" file system and the "FTP file system" (if such a link target exists).