Skip to content

close_credential: TypeError: object NoneType can't be used in 'await' expression #510

@hginzel

Description

@hginzel

This simple code

from fsspec import filesystem
from azure.identity import DefaultAzureCredential

protocol = 'az'
account_name = 'blob_account_name'
container_name = 'storage_container'
fs = filesystem(protocol,
  account_name=account_name,
  credential=DefaultAzureCredential())

blobs = fs.ls(container_name)
for blob in blobs[:5]:
  logging.info("\t" + blob)

returns error

Traceback (most recent call last):
  File "/home/h.ginzel/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/weakref.py", line 666, in _exitfunc
    f()
  File "/home/h.ginzel/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/weakref.py", line 590, in __call__
    return info.func(*info.args, **(info.kwargs or {}))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/h.ginzel/Copernicus/.venv/lib/python3.12/site-packages/fsspec/asyn.py", line 103, in sync
    raise return_result
  File "/home/h.ginzel/Copernicus/.venv/lib/python3.12/site-packages/fsspec/asyn.py", line 56, in _runner
    result[0] = await coro
                ^^^^^^^^^^
  File "/home/h.ginzel/Copernicus/.venv/lib/python3.12/site-packages/adlfs/utils.py", line 78, in close_credential
    await file_obj.credential.close()
TypeError: object NoneType can't be used in 'await' expression

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions