professor icon indicating copy to clipboard operation
professor copied to clipboard

AttributeError: 'module' object has no attribute 'Connection'

Open fones opened this issue 9 years ago • 3 comments

I have run python setup.py install without errors, and then python server.py got me this:

$ python server.py
Traceback (most recent call last):
  File "server.py", line 27, in <module>
    from professor import app as application
  File "/Users/fones/Documents/Git/professor/professor/__init__.py", line 44, in <module>
    conn = pymongo.Connection(**app.config.get('MONGODB_CONFIG', {}))
AttributeError: 'module' object has no attribute 'Connection'

I am from Node.js env, so dont know much about Python. My stack: MacOS 10.11.6, Python 2.7.13, MongoDB v3.2.4

fones avatar Jan 20 '17 10:01 fones

Find a way to fix that. Pull Request above.

fones avatar Jan 24 '17 12:01 fones

#Examples

https://pypi.python.org/pypi/pymongo/2.8

val922 avatar Jan 22 '18 10:01 val922

thanks to @val922.

Im coming here after reading the Introduction to Tornado, O'reilly book 2012 edition.

Use MongoClient instead of Connection

>>> import pymongo
>>> conn = pymongo.MongoClient('localhost', 27017) #instead of Connection
>>> pymongo.version
'3.6.0'

The pymongo api has changed after version 2.8

greed2411 avatar Jan 25 '18 10:01 greed2411