2018年2月26日 星期一

[python3] ubuntu pymongo RuntimeError: 'list' must be None or a list, not

RuntimeError: 'list' must be None or a list, not <class 'str'>

error


from pymongo import MongoClient
Traceback (most recent call last):

  File "<ipython-input-1-214d66698402>", line 1, in <module>
    from pymongo import MongoClient

  File "/usr/local/lib/python3.5/dist-packages/pymongo/__init__.py", line 77, in <module>
    from pymongo.collection import ReturnDocument

  File "/usr/local/lib/python3.5/dist-packages/pymongo/collection.py", line 29, in <module>
    from pymongo import (common,

  File "/usr/local/lib/python3.5/dist-packages/pymongo/common.py", line 28, in <module>
    from pymongo.auth import MECHANISMS

  File "/usr/local/lib/python3.5/dist-packages/pymongo/auth.py", line 120, in <module>
    from backports.pbkdf2 import pbkdf2_hmac

  File "<frozen importlib._bootstrap>", line 969, in _find_and_load

  File "<frozen importlib._bootstrap>", line 954, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 892, in _find_spec

  File "<frozen importlib._bootstrap>", line 873, in _find_spec_legacy

  File "/usr/local/lib/python3.5/dist-packages/pyximport/pyximport.py", line 253, in find_module
    fp, pathname, (ext,mode,ty) = imp.find_module(fullname,package_path)

  File "/usr/lib/python3.5/imp.py", line 270, in find_module
    "not {}".format(type(name)))

RuntimeError: 'list' must be None or a list, not <class 'str'>


solve

Package "backports.pbkdf2 " is  dependence package on pymongo.  Offical website alse show this Info.
So install  backports.pbkdf2 will solve.

sudo pip3 install backports.pbkdf2