python - mktime 参数超出范围

标签 python azure azureservicebus azure-sdk-python

我正在将 azure-sdk 用于 python,特别是 azure-servicebus 0.50.0

from azure.servicebus import QueueClient
service_bus_queue_connectionString= "my service bus string"
service_bus_queue_name ="service bus queue"
queue_client = QueueClient.from_connection_string(service_bus_queue_connectionString, service_bus_queue_name)
sessions= queue_client.list_sessions() print(sessions)

使用以下代码时,我收到以下错误

An exception of type OverflowError occurred. Arguments: ('mktime argument out of range',)

可能的原因是什么?

编辑 请找到堆栈跟踪。任何帮助将不胜感激。

File "C:\Users\NewtonCode\Desktop\EY.TPBML.PY - Copy\model_engine.py", line 28, in start_process
    sessions = self.queue_client.list_sessions()
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\azure\servicebus\servicebus_client.py", line 469, in list_sessions
    mgmt_handlers.list_sessions_op)
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\azure\servicebus\base_handler.py", line 83, in _mgmt_request_response
    **kwargs))
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\uamqp\message.py", line 109, in __init__
    self._body.set(body)
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\uamqp\message.py", line 913, in set
    value = utils.data_factory(value)
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\uamqp\utils.py", line 108, in data_factory
    wrapped_dict[data_factory(key, encoding=encoding)] = data_factory(item, encoding=encoding)
  File "C:\Users\NewtonCode\AppData\Local\Continuum\anaconda3\lib\site-packages\uamqp\utils.py", line 117, in data_factory
    timestamp = int((time.mktime(value.utctimetuple()) * 1000) + (value.microsecond/1000))
OverflowError: mktime argument out of range

最佳答案

感谢您提出此问题 - 它看起来像是库中的错误。

虽然不是解决方案 - 我在此处的底层 uAMQP 库中提出了一个问题: https://github.com/Azure/azure-uamqp-python/issues/63

同时,您可以通过将“updated-since”时间戳传递到 list_sessions 操作中来解决此问题:

# Start time of a week ago - replace with appropriate value
start_time = datetime.datetime.now() - datetime.timedelta(weeks=1)
sessions = queue_client.list_sessions(updated_since=start_time)

再次感谢,我会尽快发布修复程序! :)

关于python - mktime 参数超出范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55357199/

相关文章:

python - 在 Jinja 中使用嵌入的 HTML 渲染 WTForms SelectField 选项

python - PyQt QVBoxLayout 和缺少的小部件?

python - 自动远程安装 mysql-server 和 postfix

asp.net - 在 Azure 中工作的 CAPTCHA 控件

通过 AZURE JAVA SDK 访问 Azure 服务总线 SAS

azure - Azure 服务总线可以提供消息日记功能吗?

python - plt.tight_layout 带有长标题的错误?

azure - 将 Access-Control-Max-Age 添加到 Azure Functions

azure - Azure 区域对和可用区域之间的区别?

c# - WCF 中继已连接到监听器,但没有连接监听器?