question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

az storage fails with TypeError: NoneType object is not iterable

See original GitHub issue

Describe the bug

Upload of a storage blob or listing of the storage account keys using the current version of the azure-cli from https://packages.microsoft.com/yumrepos/azure-cli (Version 2.38.0) fails with a TypeError:

    return ' '.join(['({}){}'.format(x[0], x[1:]) for x in allowed_values])
TypeError: 'NoneType' object is not iterable

Command Name

Issue arises in either of those commands:

  • az storage blob upload
  • az storage account keys list

Errors:

az storage blob upload

The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 561, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 516, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 31, in load_arguments
    load_arguments(self, command)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_params.py", line 684, in load_arguments
    get_permission_help_string(t_account_permissions)),
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_validators.py", line 862, in get_permission_help_string
    return ' '.join(['({}){}'.format(x[0], x[1:]) for x in allowed_values])
TypeError: 'NoneType' object is not iterable
$ az storage account keys list --resource-group {}--account-name {}
The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "/usr/lib64/az/lib/python3.6/site-packages/knack/cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/commands/__init__.py", line 561, in execute
    self.commands_loader.load_arguments(command)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/core/__init__.py", line 516, in load_arguments
    loader.load_arguments(command)  # this adds entries to the argument registries
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/__init__.py", line 31, in load_arguments
    load_arguments(self, command)
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_params.py", line 684, in load_arguments
    get_permission_help_string(t_account_permissions)),
  File "/usr/lib64/az/lib/python3.6/site-packages/azure/cli/command_modules/storage/_validators.py", line 862, in get_permission_help_string
    return ' '.join(['({}){}'.format(x[0], x[1:]) for x in allowed_values])
TypeError: 'NoneType' object is not iterable

To Reproduce:

  • az storage blob upload --max-connections 4 --container-name {} --account-name {} --type page --file {} --name {}

or

  • az storage account keys list --resource-group {}--account-name {}

Expected Behavior

  • The corresponding command runs instead of the TypeError

Environment Summary

Linux-6.0.8-1-default-x86_64-with-glibc2.36, openSUSE Tumbleweed
Python 3.10.8
Installer: RPM

azure-cli 2.38.0 *

Additional Context

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
evelyn-yscommented, Dec 1, 2022

Please ensure the storage dependency is correctly installed. This error occurs when no enum definition read from dependency SDK.

Here’s the official doc for installing cli together with all the dependencies: https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

0reactions
grisu48commented, Dec 8, 2022

Sorry, I made a mistake in the previous reply. You need to install python3.6, in other word, make python3.6 executable.

cat /usr/bin/az show that it itries to use python3.6 to run az, if not found, uses python3 instead. Thus, the error raises.

Thank you! I leave this here for any other folk who find this issue. I switched in the meantime to my distribution-package, where this issue is not present.

Closing issue as it is not present anymore. Thanks everyone for the input and help! 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

`az storage account list` TypeError: NoneType object is not ...
The command failed with an unexpected error. Here is the traceback: 'NoneType' object is not iterable Traceback (most recent call last): ...
Read more >
How to Fix TypeError in Python: NoneType Object Is Not Iterable
The Python TypeError: NoneType Object Is Not Iterable error can be avoided by checking if a value is None or not before iterating...
Read more >
az servicebus list gives NoneType error in python
I have realized that this error exist only when there are no servicebus in the account. Instead of giving value = [] cli...
Read more >
AzureCLI@1 running az acr build. ERROR: 'NoneType' object ...
ERROR : 'NoneType' object is not callable ... We are running a couple of pipelines which use az acr build to build and...
Read more >
I am getting failures when trying to download a blob from ...
and I am getting this error: The command failed with an unexpected error. Here is the traceback: 'BlobServiceClient' object has no attribute 'exists'...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found