Info
ftputil version: 2.2.2
python: 2.5.1
ftpserver: proftpd on localhost
OS: Linux julian-laptop 2.6.20-16-generic #2 SMP Thu Jun 7 20:19:32 UTC 2007 i686 GNU/Linux
Bug
The os and ftputil modules don't work the same when it comes to isdir:
ftputil's path.isdir(d) raises an TemporaryError? if the os.path.dirname of the variable d is non-existent path. Thus, assuming the working dirs of os and ftputil are empty directories, this would be an example:
import ftputil
import os
h = ftputil.FTPHost(server, user, password)
print os.path.isdir('foo') # outputs False
print h.path.isdir('foo') # outputs False
print os.path.isdir('foo/bar') # outputs False
print h.path.isdir('foo/bar')
# raises ftputil.ftp_error.TemporaryError on 'foo'
# another example:
print os.path.isdir('foo/bar/helloworld') # outputs False
print h.path.isdir('foo/bar/helloworld')
# raises ftputil.ftp_error.TemporaryError on 'foo/bar'
traceback output from python console:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/julian/develop/python/ftputil/ftp_path.py", line 116, in isdir
path, _exception_for_missing_path=False)
File "/home/julian/develop/python/ftputil/ftputil.py", line 793, in stat
return self._stat.stat(path, _exception_for_missing_path)
File "/home/julian/develop/python/ftputil/ftp_stat.py", line 537, in stat
_exception_for_missing_path)
File "/home/julian/develop/python/ftputil/ftp_stat.py", line 514, in __call_with_parser_retry
result = method(*args, **kwargs)
File "/home/julian/develop/python/ftputil/ftp_stat.py", line 481, in _real_stat
lstat_result = self._real_lstat(path, _exception_for_missing_path)
File "/home/julian/develop/python/ftputil/ftp_stat.py", line 436, in _real_lstat
lines = self._host_dir(dirname)
File "/home/julian/develop/python/ftputil/ftp_stat.py", line 367, in _host_dir
return self._host._dir(path)
File "/home/julian/develop/python/ftputil/ftputil.py", line 750, in _dir
lines = self._robust_ftp_command(command, path, descend_deeply=True)
File "/home/julian/develop/python/ftputil/ftputil.py", line 551, in _robust_ftp_command
return command(self, path)
File "/home/julian/develop/python/ftputil/ftputil.py", line 748, in command
ftp_error._try_with_oserror(self._session.dir, '-a '+path, callback)
File "/home/julian/develop/python/ftputil/ftp_error.py", line 83, in _try_with_oserror
raise TemporaryError(obj)
ftputil.ftp_error.TemporaryError: 450 /foo: No such file or directory
Debugging info: ftputil 2.2.2, Python 2.5.1 (linux2)
>>>
ok, thanks ;)
julian