Skip to content

AttributeError: 'NoneType' object has no attribute 'headers' while upload file with azure client #23423

@gavrochexu

Description

@gavrochexu

This is autogenerated. Please review and update as needed.

Describe the bug

Command Name
az dls fs upload

Errors:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object has no attribute 'headers'
Traceback (most recent call last):
  File "/opt/az/lib/python3.10/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 663, in execute
    raise ex
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 726, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 697, in _run_job
    result = cmd_copy(params)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/__init__.py", line 333, in __call__
    return self.handler(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/core/commands/command_operation.py", line 121, in handler
    return op(**command_args)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/dls/custom.py", line 180, in upload_to_adls
    client = cf_dls_filesystem(cmd.cli_ctx, account_name)
  File "/opt/az/lib/python3.10/site-packages/azure/cli/command_modules/dls/_client_factory.py", line 40, in cf_dls_filesystem
    return core.AzureDLFileSystem(
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/core.py", line 72, in __init__
    self.connect()
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/core.py", line 90, in connect
    self.azure = DatalakeRESTInterface(token=self.token, req_timeout_s=self.per_call_timeout_seconds, **self.kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/lib.py", line 273, in __init__
    self._check_token()  # Retryable method. Will ensure that signed_session token is current when we set it on next line
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/lib.py", line 307, in _check_token
    check_token_internal()
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/retry.py", line 93, in f_retry
    out = func(*args, **kwargs)
  File "/opt/az/lib/python3.10/site-packages/azure/datalake/store/lib.py", line 305, in check_token_internal
    self.head = {'Authorization': cur_session.headers['Authorization']}
AttributeError: 'NoneType' object has no attribute 'headers'

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az dls fs upload --account {} --source-path {} --destination-path {}

Expected Behavior

Environment Summary

Linux-5.15.0-1014-azure-x86_64-with-glibc2.31, Ubuntu 20.04.4 LTS
Python 3.10.5
Installer: DEB

azure-cli 2.39.0

Additional Context

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions