【问题标题】:az servicebus list gives NoneType error in pythonaz servicebus list 在 python 中给出 NoneType 错误
【发布时间】:2021-06-11 03:23:46
【问题描述】:

命令名称 我试过az servicebus namespace list,但是在一些输出之后它给了我 NoneType 错误意味着没有数据被检索到。此链接中提供了已安装的python包https://github.com/Azure/azure-cli/issues/18428#issuecomment-858293708

错误:

The command failed with an unexpected error. Here is the traceback:
'NoneType' object is not iterable
Traceback (most recent call last):
  File "C:\Users\Mp\AppData\Roaming\Python\Python39\site-packages\knack\cli.py", line 231, in invoke
    cmd_result = self.invocation.execute(args)
  File "C:\Python39\lib\site-packages\azure\cli\core\commands\__init__.py", line 657, in execute
    raise ex
  File "C:\Python39\lib\site-packages\azure\cli\core\commands\__init__.py", line 720, in _run_jobs_serially
    results.append(self._run_job(expanded_arg, cmd_copy))
  File "C:\Python39\lib\site-packages\azure\cli\core\commands\__init__.py", line 704, in _run_job
    result = list(result)
  File "C:\Users\Mp\AppData\Roaming\Python\Python39\site-packages\azure\core\paging.py", line 129, in __next__
    return next(self._page_iterator)
  File "C:\Users\Mp\AppData\Roaming\Python\Python39\site-packages\azure\core\paging.py", line 84, in __next__
    self.continuation_token, self._current_page = self._extract_data(self._response)
  File "C:\Python39\lib\site-packages\azure\mgmt\servicebus\operations\_namespaces_operations.py", line 371, in extract_data
    return deserialized.next_link or None, iter(list_of_elem)
TypeError: 'NoneType' object is not iterable

复制:

  • az servicebus namespace list --subscription {} --query {} --output {}

预期行为

在特定订阅中提供 azure servicebus 列表

环境总结

Windows-10-10.0.19041-SP0
Python 3.8.9
Installer: MSI

azure-cli 2.24.0 *

Extensions:
logic 0.1.3


更新

我意识到这个错误只有在帐户中没有服务总线时才会存在。而不是给 value = [] cli 引发此错误。

【问题讨论】:

    标签: python python-3.x azure command-line-interface


    【解决方案1】:

    它对我来说很好,可能你没有传递一些值,检查下面的命令,

    az servicebus namespace authorization-rule list --resource-group myresourcegroup --namespace-name mynamespace
    

    【讨论】:

    • 我正在尝试列出与订阅相关的所有服务总线,因此我无法传递 --namespace-name 参数
    猜你喜欢
    • 2022-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多