Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fones opened this issue Jan 20, 2017 · 3 comments · May be fixed by #14
Open

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

fones opened this issue Jan 20, 2017 · 3 comments · May be fixed by #14

Comments

@fones
Copy link

fones commented Jan 20, 2017

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 fones linked a pull request Jan 24, 2017 that will close this issue
@fones
Copy link
Author

fones commented Jan 24, 2017

Find a way to fix that. Pull Request above.

@val922
Copy link

val922 commented Jan 22, 2018

#Examples

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

@greed2411
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants