Re: [Evolution-hackers] Accessing EDS in Python



Hi, 

On Sun, 2011-07-24 at 21:42 +0200, David Klasinc wrote:
> Greetings,
> 
> I am trying to do a simple search in the address book, this is the code 
> that refuses to work:
> 
> #!/usr/bin/python
> 
> from gi.repository import EBook
> 
> contacts = []
> 
> # Initialize client and open it
> client = EBook.BookClient.new_system()
> # Set the query
> query_string = "(contains \"full_name\" \"N\")"
> 
> print "Look for:", query_string
> 
> # Get some contacts!
> ret = EBook.BookClient.get_contacts_sync(client, query_string, contacts, 
> None)
> 
> print contacts
> 
> if not ret:
>    print "*sob*"
> 
> List contacts is always empty and upon running I get the assertion error:
> (process:5032): libebook-CRITICAL **: e_book_client_get_contacts_sync: 
> assertion `contacts != NULL' failed
> 

A couple of things, get_contacts_sync is an instance method so should
just do:

client.get_contacts_sync(...)

Also, the e_book_client_get_contacts_sync() is badly annotated so the 
Contacts out param is not being picked up by gobject-introspection. I am
pushing a fix for that now. 

Finally, asking around in #gobject-introspection, out params aren't used
as such by pygobject but they are returned to yoy. So in this case
you'll end up having to call (once you get a corrected GIR file for
e-d-s):

ret, contacts = client.get_contacts_sync(query_string, None)

Cheers,
Raul 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]