-
Notifications
You must be signed in to change notification settings - Fork 409
Closed
Description
#1794 added async_wrapper
to the known_implementations
in registry, but did so without an error message (the err
element):
https://github.com/fsspec/filesystem_spec/blob/master/fsspec/registry.py#L75-L77
Therefore, trying to list available/working protocols using the following code snippet:
import fsspec
working_protocols = []
for protocol in fsspec.available_protocols():
try:
fsspec.get_filesystem_class(protocol)
working_protocols.append(protocol)
except ImportError:
pass
print(working_protocols)
fails with 2025.3.0 when morefs
is not installed, whereas it used to work in earlier versions. That's because the lack of err
ends up triggering a KeyError
instead of an ImportError
:
Traceback (most recent call last):
File "[...]/lib64/python3.13/site-packages/fsspec/registry.py", line 250, in get_filesystem_class
register_implementation(protocol, _import_class(bit["class"]))
~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "[...]/lib64/python3.13/site-packages/fsspec/registry.py", line 286, in _import_class
mod = importlib.import_module(mod)
File "/usr/lib64/python3.13/importlib/__init__.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
File "<frozen importlib._bootstrap>", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'morefs'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "list_working_protocols.py", line 6, in <module>
fsspec.get_filesystem_class(protocol)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
File "[...]/lib64/python3.13/site-packages/fsspec/registry.py", line 253, in get_filesystem_class
raise ImportError(bit["err"]) from e
~~~^^^^^^^
KeyError: 'err'
Metadata
Metadata
Assignees
Labels
No labels