TypeError:字符串索引必须是ArangoDB上的整数

问题描述 投票:0回答:1

Arango模块在访问数据库时给出了一个奇怪的错误:

from arango import ArangoClient 
client = ArangoClient(hosts='http://localhost:8529/') 
sys_db = client.db('_system', username='root', password='root')
sys_db.databases()

下面是错误:

追踪(最近一次通话):文件“”,第1行,在文件“ /home/ubuntu/arangovenv/lib/python3.6/site-packages/arango/database.py”,数据库中的第699行返回self._execute(request,response_handler)文件“ /home/ubuntu/arangovenv/lib/python3.6/site-packages/arango/api.py”,_execute中的第66行返回self._executor.execute(request,response_handler)文件“ /home/ubuntu/arangovenv/lib/python3.6/site-packages/arango/executor.py”,第82行,在执行中返回response_handler(resp)文件“ /home/ubuntu/arangovenv/lib/python3.6/site-packages/arango/database.py”,第697行,在response_handler中返回resp.body ['result'] TypeError:字符串索引必须为整数

从“ packages / arango / database.py”中调用数据库模块给了我同样的错误。

我的环境:

1)Ubuntu 16.4

2)python-arango == 5.2.1

任何帮助。

python-3.6 arangodb pyarango
1个回答
0
投票

我猜,resp.body不是您提供的数据类型。 line 697中的database.py正在期待其他内容。例如:

>>> data = "MyName"
>>> print(data[0])
'M'
>>> print(data['anything'])
TypeError: string indices must be integers

第一print命令给出结果,而秒命令则抛出错误。

我希望这可以解决您的问题。

© www.soinside.com 2019 - 2024. All rights reserved.