twisted / txmongo

asynchronous python driver for mongo
https://txmongo.readthedocs.io
Apache License 2.0
338 stars 102 forks source link

builtins.AttributeError: '_CaseInsensitiveDictionary' object has no attribute 'copy' #252

Closed tonal closed 5 years ago

tonal commented 5 years ago

versions: txmongo 19.1.0 pymongo 3.9.0

Error in txmongo/connection.py line: 259 ConnectionPool.init

wc_options = self.__uri['options'].copy()

Forget copy() in pymongo._CaseInsensitiveDictionary

IlyaSkriblovsky commented 5 years ago

Thanks for reporting. PyMongo <3.9 used plain dict there...

userlond commented 5 years ago

Temporary fix is to downgrade to pymongo 3.8.0

tonal commented 5 years ago

@userlond I use monkeypath:

import pymongo
if pymongo.version_tuple == (3, 9, 0):
  def _cid_copy(self):
    return self.__class__(**self)
  pymongo.common._CaseInsensitiveDictionary.copy = _cid_copy