1

I can't connect mongodb on server with debian and python 2.6.6 on this line:

connection = pymongo.Connection('mongodb://localhost', safe = True)

TypeError: init() got an unexpected keyword argument 'safe'

The same code works on window machine with python 2.7.3. Could you please explain how to correct this error?

I have pymongo version 2.3 on machine where it works and 1.7 where it doesn't work.

8
  • What version of pymongo do you use on your servers? Commented Nov 5, 2012 at 11:26
  • Could you please tell me how to get pymongo version? Commented Nov 5, 2012 at 11:27
  • I tried on server: pymongo.__dict__['version']. It shows: 1.7 Commented Nov 5, 2012 at 11:34
  • import pymongo; print pymongo.version Commented Nov 5, 2012 at 11:34
  • pymongo 1.7 does not have 'safe' parameter of the 'Connection' method. Moreover this version is really old one. You should look for a updating. Commented Nov 5, 2012 at 11:38

2 Answers 2

1

Seems like you are using different versions of pymongo.

Sign up to request clarification or add additional context in comments.

6 Comments

Could you explan what you mean? You answer is not concrete and doesn't answer the question now.
your question does not actually explain the problem. How many machines do you use? We suppose that there are two machines: with python 2.6 and with python 2.7. Right?
Yes, that true. One windows machine with 2.7 (script works on it) and one debian with python 2.6 (where script doesn't work)
check versions on every machine.
I have pymongo version 2.3 on machine where it works and 1.7 where it doesn't work.
|
1

Ensure that both servers have the same pymongo version installed. Likely a version mismatch with slightly different parameter lists for the Connection constructor.

3 Comments

import pymongo; print pymongo.version
On server I have version 1.7.
Coyld you tell how to install pymongo 2.3 on debian?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.