3

After installing Ming 0.3.2, I tested the installation by running the following code:

>>> from ming.datastore import DataStore
>>> bind = DataStore('mongodb://localhost:27017/', database='tutorial')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'database'
>>> ^D

I looked at the installation files and in the datastore.py file I found that the class's constructor did not contain a "database" argument.

class DataStore(object):

    def __init__(self, bind, name, authenticate=None):
        self.bind = bind
        self.name = name
        self._authenticate = authenticate
        self._db = None

I then installed Ming 0.3.0 to look at the datastore.py file and found the DataStore class to match the documentation (it contained a database arg) and then tried that version where I encountered other complications.

I use easy_install to install Ming and I have a good install of mongodb and pymongo running. I run these on OS X Lion. Any advise on getting Ming running would be appreciated.

3 Answers3

2

I think there may be a conflict with the newest version of pymongo and ming.

bind = DataStore('mongodb://localhost:27017/', name='test') gets me a bit further along, but I ended up just using pymongo by itself.

scape
  • 652
  • 12
  • 27
2

I've met the same issue. Here are the steps I've tried, and it works! Hopes it works for your environment too.

  1. Uninstall the Ming 0.3.2 version by : pip uninstall Ming

  2. Install 0.3.0 by: pip install -Iv http://downloads.sourceforge.net/project/merciless/0.3.0/Ming-0.3.0.tar.gz

  3. Try the example on the Ming office website again. There will be another error

    Traceback (most recent call last):
    File "tutorial.py", line 1, in <module> from ming.datastore import DataStore

    File "/home/me/work/deploy/test/local/lib/python2.7/site-packages/ming/init.py", line 3, in <module> from session import Session

    File "/home/me/work/deploy/test/local/lib/python2.7/site-packages/ming/session.py", line 7, in <module> from pymongo.son import SON

    ImportError: No module named son

  4. change the line 7 of "/home/me/work/deploy/test/local/lib/python2.7/site-packages/ming/session.py" to from bson.son import SON

  5. try again. and it will works.

Here is the link I've referenced. It's a Japanese webpage, but you can translate it to English by google translator. http://ryooo321.blogspot.com/2012/05/macsleepymongoose.html

Stephan
  • 41,764
  • 65
  • 238
  • 329
marcusyh
  • 21
  • 4
0

try to remove database=.

In [8]: from ming.datastore import DataStore

In [9]: bind = DataStore('mongodb://grid:27017/', 'tutorial')

In [10]: bind.name
Out[10]: 'tutorial'
Jim Geovedi
  • 321
  • 3
  • 8