fsspec / fsspec/filesystem_spec
`FSMap.setitems` fails when `FSMap.__setitem__` succeeds (nested directory on local filesystem).
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 490
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 38
Description
When using a mapper on a local filesystem, it's possible to create nested subdirectory structures using FSMap as in:
import fsspec
import tempfile
with tempfile.TemporaryDirectory() as d:
m = fsspec.get_mapper(d)
m["foo/bar"] = b"baz"
however, trying the same thing using setitems fails:
import fsspec
import tempfile
with tempfile.TemporaryDirectory() as d:
m = fsspec.get_mapper(d)
m.setitems({"foo/bar": b"baz"})
I'd expect the latter to work just as well as the former, however, it raises:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmp4msurdfc/foo/bar'
This is likely because there's no mkdirs in setitems, while there is one in __setitem__. I don't know which place would be the best to put a mkdirs-like call when setting multiple items at once.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in fsspec/mapping.py by comparing setitems with setitem, especially their directory-creation behavior. Reproduce the nested-key examples from the issue, then add regression coverage and confirm that setitems handles keys such as "foo/bar" on a local filesystem without raising FileNotFoundError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100