gpt4 book ai didi

python - mktime 参数超出范围

转载 作者:行者123 更新时间:2023-12-01 01:05:58 24 4
gpt4 key购买 nike

我正在将 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com