You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
>>> from fsspec import filesystem
>>> m = filesystem("memory")
>>> m.mkdir("/a/b")
>>> m.ls("/a")
[{'name': '/a/b', 'size': 0, 'type': 'directory'}]
>>> from pathlib import Path
>>> a = Path("/a")
>>> m.ls(a)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/eleven/.local/lib/python3.11/site-packages/fsspec/implementations/memory.py", line 37, in ls
path = self._strip_protocol(path)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/eleven/.local/lib/python3.11/site-packages/fsspec/implementations/memory.py", line 29, in _strip_protocol
if path.startswith("memory://"):
^^^^^^^^^^^^^^^
AttributeError: 'PosixPath' object has no attribute 'startswith'
I think the memoryFS shouldn't implement it's own _strip_protocol, which is merged by #654 .
The text was updated successfully, but these errors were encountered:
As you can see in that PR, there are some peculiarities of memoryFS that require particular coding in _strip_protocol. It should maybe call super()._strip_protocol as part of its call, which may solve this.
However, it's not exactly obvious that Path objects ought to work with non-standard filesystems like memory. I am not strongly against, but I don't see the motivation. Have you tried https://github.com/fsspec/universal_pathlib ?
I think the memoryFS shouldn't implement it's own
_strip_protocol
, which is merged by #654 .The text was updated successfully, but these errors were encountered: