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

Cannot import name Connection #16

Closed
Alex85651 opened this issue Oct 19, 2016 · 4 comments
Closed

Cannot import name Connection #16

Alex85651 opened this issue Oct 19, 2016 · 4 comments

Comments

@Alex85651
Copy link

Alex85651 commented Oct 19, 2016

Hi guys,
I had an error while trying to make this module work
Cannot import name Connection

This was caused by this import
try:
from pymongo.connection import Connection
except ImportError:
Connection = None

It appears that since the version 3.0 of pymongo, the module Connection does no longer exist and can now be found in the MongoClient package. So I decided to change the part of the code that no longer work.
try:
from pymongo import MongoClient as Connection
except ImportError:
Connection = None

It would be great to update this :)

@thabend0r
Copy link

Hey,
I got the same error. seems this packages is very outdated.

when making the change suggested above i get the following error:

[1479896067] ERROR: [Shinken] The module retention-mongodb raised an exception 'Module' object has no attribute 'uri', I remove it! traceback=Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/shinken/modulesmanager.py", line 234, in get_instances
inst = module.get_instance(mod_conf)
File "/var/lib/shinken/modules/retention-mongodb/module.py", line 66, in get_instance
uri = plugin.uri
AttributeError: 'Module' object has no attribute 'uri'

@clonedagain
Copy link
Contributor

Isn't this a duplicate of #8 ?

@olivierHa
Copy link
Member

I think so. Could you try with master version of this module if you got an issue ?

@clonedagain
Copy link
Contributor

master works for me, following these steps:

  • shinken install retention-mongodb
  • cloned this repo to /tmp
  • copied /tmp/mod-retention-mongodb/module/* to /var/lib/shinken/modules/retention-mongodb/
  • restarted shinken

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

No branches or pull requests

4 participants