Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Django and Mongodb
PostPosted: Wed Aug 18, 2010 1:10 pm 
Offline
Newbie

Joined: Thu Aug 05, 2010 2:22 pm
Posts: 4
I have an install of mongo and django setup with virtualenv.

Everything works great until I try to use pymongo to connect to the mongo server.

I get the connection, and I can see the database, but when I run the following test I get unicode errors.

Code:
>>> import django
>>> import pymongo
>>> connection = pymongo.Connection("localhost", 27017)
>>> db = connection.test
>>> db.name()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
TypeError: 'unicode' object is not callable


I'm not sure what that means or how to fix it. Does anyone have suggestions?


Top
   
 Post subject:
PostPosted: Wed Aug 18, 2010 1:16 pm 
Offline
Senior Member

Joined: Sat Mar 28, 2009 4:23 pm
Posts: 415
Website: http://jedsmith.org/
Location: Out of his depth and job-hopping without a clue about network security fundamentals
Drop the parens. What the traceback is telling you is that you're trying to call a Unicode string like a function, i.e.:

Code:
In [1]: spackle = "wasps"

In [2]: spackle()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/Users/jsmith/<ipython console> in <module>()

TypeError: 'str' object is not callable


Try typing just:

Code:
>>> db.name


The documentation for database.name explains that it was changed to a property instead of a method (maybe recently).

_________________
Disclaimer: I am no longer employed by Linode; opinions are my own alone.


Top
   
 Post subject: Awesome!
PostPosted: Wed Aug 18, 2010 1:45 pm 
Offline
Newbie

Joined: Thu Aug 05, 2010 2:22 pm
Posts: 4
Thanks.. that was the problem. So my install is work as needed. Sweet.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group