That is because of the new 
displayhook http://trac.sagemath.org/ticket/14469, which decides whether to 
show something graphically by whether an object has a _graphics_() method 
or not. Apparently pymongo uses a getattr hack that claims to have all and 
every method implemented, and then fails flat on its face when you actually 
try. Well thats nice. I'll fix it.

Note that this error will just appear if you (implicitly) call the 
displayhook. Pymongo is working just fine, only the implicit printing is 
broken: 

sage: import pymongo 
sage: c = pymongo.Connection()
sage: c.__repr__()
"Connection('localhost', 27017)"
sage: c
Traceback (most recent call last)
...
TypeError: 'Database' object is not callable. If you meant to call the 
'_graphics_' method on a 'Connection' object it is failing because no such 
method exists.



On Tuesday, August 20, 2013 11:49:38 AM UTC+1, John Cremona wrote:
>
> Here's a problem.   Using Sage 5.11 and pymongo 2.6 (installed using 
> easy_install after sage -sh) this works fine: 
>
> sage: import pymongo 
> sage: C=pymongo.Connection('localhost:27017') 
> sage: D=C['elliptic_curves'] 
> sage: D 
> Database(Connection('localhost', 27017), u'elliptic_curves') 
>
> but with 5.12 and the same pymongo, displaying D leads to an error: 
>
> TypeError: 'Collection' object is not callable. If you meant to call 
> the '_graphics_' method on a 'Database' object it is failing because 
> no such method exists. 
>
> the traceback including something in sage/misc/displayhook.pyc.  And 
> running Ipython directly (using sage -python with the 5.12 Sage) works 
> fine. 
>
> For a simpler example (only requiring some default mongod running): 
>
> sage: import pymongo 
> sage: pymongo.Connection() 
>
> <boom> 
>
>
> John 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to