gpt4 book ai didi

python - 属性错误 : 'str' object has no attribute 'isoformat'

转载 作者:太空狗 更新时间:2023-10-30 00:55:23 26 4
gpt4 key购买 nike

<分区>

我有代码,但我不知道如何解决问题。代码:

import dateutil.parser
import datetime
from novaclient.v2 import client as nova_client
from keystoneclient.auth.identity import v2
from keystoneclient import session

auth=v2.Password(auth_url="http://openstack2-prakt.in.linux.edu.lv:5000/v2.0",
username="***",
password="****",
tenant_name="********")
sess=session.Session(auth=auth)
nova=nova_client.Client(version="2", session=sess)

usage_list=nova.usage.get(tenant_id="**************",start='%Y-%m-%d', end='%Y-%m-%d')
for us in usage_list:
print us.total_vcpus_usage

我执行代码后,出现下一个问题:

No handlers could be found for logger "keystoneclient.auth.identity.base"

Traceback (most recent call last):
File "/home/eleonora/PycharmProjects/untitled/nova test.py", line 32, in <module>
usage_list=nova.usage.get(tenant_id="c56f75091edc4480a204e5549ef11664",start='%Y-%m-%d', end='%Y-%m-%d')
File "/usr/local/lib/python2.7/dist-packages/novaclient/v2/usage.py", line 60, in get
(tenant_id, start.isoformat(), end.isoformat()),
AttributeError: 'str' object has no attribute 'isoformat'

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