[Evolution-hackers] Accessing EDS in Python



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

If I put something assign a value to contacts (contacts = [0,1,2,3]) then there is no assertion error and there's a little pause, as if search was being performed, before the final *sob* is printed out and contacts list is unchanged (still contains 0,1,2,3)

If anyone can provide me with a working example of a search and basic access to EDS in python, I'd appreciate it. I am doing all this on Ubuntu, Oneiric Ocelot, latest daily build, so this might be an Ubuntu thing, that is why I would like a working python example, so I can rule out Ubuntu.

rgrds,
David






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