AttributeError:'WriteConcern'对象没有'已确认'属性

时间:2015-08-04 15:04:48

标签: python mongodb gridfs

我已经在MongoDB数据库中存储了一个pdf,我按如下方式访问它:

dbPDFReports = client['pdfReports']

客户端是我的 MongoClient ,如下所示:

client = MongoClient(some_ip, 27017)

但是我收到了这个错误:

AttributeError: 'WriteConcern' object has no attribute 'acknowledged'

知道为什么吗?

修改

升级pymongo后,我得到了以下追溯:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    from bulk import *
  File "/home/inno/InnovAccer/Projects/tiger-global-backend/API/bulk.py", line 1, in <module>
    from pymongo import MongoClient
  File "/home/inno/InnovAccer/Projects/tiger-global-backend/API/pymongo/__init__.py", line 83, in <module>
    from pymongo.collection import ReturnDocument
  File "/home/inno/InnovAccer/Projects/tiger-global-backend/API/pymongo/collection.py", line 22, in <module>
    from bson.py3compat import (_unicode,
ImportError: cannot import name _unicode

1 个答案:

答案 0 :(得分:2)

pymongo升级为currently latest (3.0.3) version

pip install --upgrade pymongo