adlfs
adlfs copied to clipboard
Weird behavior for directories / cache
import secrets
from adlfs import AzureBlobFileSystem
BUCKET = 'test-8/'
FOLDER = f'test-8/{secrets.token_hex(12)}/'
fs = AzureBlobFileSystem(account_name=_NAME, account_key=_KEY)
with fs.open(FOLDER + 'foo', 'w') as stream:
stream.write('x')
with fs.open(FOLDER + 'bar', 'w') as stream:
stream.write('z')
fs.ls(BUCKET)
print(fs.info(FOLDER))
print(fs.info(FOLDER))
$ python t.py
{'name': 'test-8/e1f1ff1f764c3981f114e47b', 'size': 0, 'type': 'directory'}
Traceback (most recent call last):
File "t.py", line 18, in <module>
print(fs.info(FOLDER))
File "/home/isidentical/adlfs/adlfs/spec.py", line 534, in info
fetch_from_azure = (path and self._ls_from_cache(path) is None) or refresh
File "/home/isidentical/.venv38/lib/python3.8/site-packages/fsspec/spec.py", line 336, in _ls_from_cache
return self.dircache[path]
File "/home/isidentical/.venv38/lib/python3.8/site-packages/fsspec/dircache.py", line 62, in __getitem__
return self._cache[item] # maybe raises KeyError
KeyError: 'test-8/e1f1ff1f764c3981f114e47b/'
The first info succeeds, but then the second one just fails. Might be related to #188