Can't import Connection from pymongo using mongodb_log [closed]

asked 2020-02-04 04:49:37 -0600

StefanB gravatar image

updated 2020-02-04 04:54:03 -0600

Hi,

I am trying to use mongodb_log

I installed mongodb_log with:

git clone https://github.com/timn/ros-mongodb_log.git mongodb_log
cd mongodb_log
make

I also installed pymongo with:

$ git clone git://github.com/mongodb/mongo-python-driver.git pymongo
$ cd pymongo/
$ python setup.py install

However, when I start the application using:

$ rosrun ngodb_log mongodb_log -a

I get an error saying:

Traceback (most recent call last):
File "/home/<xxxx>/KnowRob_ws/src/mongodb_log/bin/mongodb_log", line 68, in <module>
    from pymongo import Connection, SLOW_ONLY
ImportError: cannot import name Connection

Looking into the pymongo source code from git I indeed cannot find a class named Connection. I do however find a class named MongoClient, which takes the same arguments. Changing mongodb_log.py from 'Connection' to 'MongoClient' allows me to run the application with the following output:

Updated graphs, total queue size 0, dropped 0, took 0:00:00.000381
Updated graphs, total queue size 0, dropped 0, took 0:00:00.000393
...

Is this a bug or am I missing something? Or should I contact the pymongo maintainer?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by StefanB
close date 2020-02-04 05:12:47.556814

Comments

1

Just an observation: timn/ros-mongodb_log hasn't been updated since 2012. That's 8 years.

There is every reason to assume all of its dependencies have been updated and the thing suffers from serious bit rot.

gvdhoorn gravatar image gvdhoorn  ( 2020-02-04 04:56:28 -0600 )edit
1

It looks like ros-mongodb_logrepository is outdated/unmaintained (last commit in 2012).

I am trying to use mongodb_log

The code used to release the mongodb_logROS package is at https://github.com/strands-project/mo... It can also be installed from packages apt install ros-melodic-mongodb-log

Maybe you'll have more luck trying those

marguedas gravatar image marguedas  ( 2020-02-04 05:05:17 -0600 )edit

@marguedas This solved it for me, thanks!

StefanB gravatar image StefanB  ( 2020-02-04 05:12:23 -0600 )edit

Great!

Follow-up ticket to fix the wiki inconsistency: https://github.com/strands-project/mo...

marguedas gravatar image marguedas  ( 2020-02-04 05:39:39 -0600 )edit