-
-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FTPFS: EOFError in listdir #292
Comments
PyFilesystem methods should translate all exceptions to the common exceptions. So if listdir is throwing an EOFError, that would be considered a bug. If you have a traceback I could have a look at it, or a PR is always welcome. |
Traceback: Traceback (most recent call last):
File "test.py", line 6, in <module>
fs.listdir('.')
File "/usr/lib/python3.7/site-packages/fs/wrapfs.py", line 152, in listdir
dir_list = _fs.listdir(_path)
File "/usr/lib/python3.7/site-packages/fs/ftpfs.py", line 628, in listdir
dir_list = [info.name for info in self.scandir(_path)]
File "/usr/lib/python3.7/site-packages/fs/ftpfs.py", line 628, in <listcomp>
dir_list = [info.name for info in self.scandir(_path)]
File "/usr/lib/python3.7/site-packages/fs/ftpfs.py", line 721, in _scandir
lambda l: lines.append(_decode(l, self.ftp.encoding)),
File "/usr/lib/python3.7/ftplib.py", line 467, in retrlines
resp = self.sendcmd('TYPE A')
File "/usr/lib/python3.7/ftplib.py", line 273, in sendcmd
return self.getresp()
File "/usr/lib/python3.7/ftplib.py", line 236, in getresp
resp = self.getmultiline()
File "/usr/lib/python3.7/ftplib.py", line 222, in getmultiline
line = self.getline()
File "/usr/lib/python3.7/ftplib.py", line 210, in getline
raise EOFError
EOFError |
Looks like that's coming from https://github.com/python/cpython/blob/master/Lib/ftplib.py#L210 There appears to be a mismatch as the ftplib docs say "This set includes the four exceptions listed above as well as OSError." but the ftplib code says |
I've tried catching UpdateFrom the Python docs:
|
* Handle EOFError (closes #292) * Update CHANGELOG and CONTRIBUTORS
|
Hello,
I am new to pyfilesystem, so please excuse if i might have missed something. From what i can understand from the documentation pyfilesystem2 translates exceptions from the underlying filesystem into a common set of exceptions.
There seems to be a corner case for ftpfs where it might raise EOFError in listdir if the server forcefully closes the connection during the operation. This exception seems to be coming from the underlying ftplib.
The text was updated successfully, but these errors were encountered: