View Full Version : Python - Access Abook
falkontre
01-07-2010, 05:20 PM
Hello there.
I'm a really a newbie in Python and maemo development, so sorry in advance for my silly questions.
I've studied the tutorial about GUI...really impressive, but now I want to go forward and I'd like to learn how to use binding modules...
I've found on pymaemo web site some examples about abook, the python module that is used to access address book.
In these examples ther's an
impot abook
statement.
when I try to launch it...an error message is displayed like this:
ImportError: No module named abook
On the device I've installed the pymaemo env and I'm using Pluthon on windows platform (I've tried also ESbox from Ubuntu...and evenmore...directly onto the device with pyGTKEditor).
Any clue?
Thank you very much to all.
Jaffa
01-07-2010, 06:09 PM
I've found on pymaemo web site some examples about abook, the python module that is used to access address book.
Unfortunately, libabook has no Python bindings on Fremantle at the moment.
There are two alternatives:
python-evolution (http://maemo.org/packages/view/python-evolution/) can give you access to the local Evolution database part of the address book (http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide/Using_Generic_Platform_Components/Using_Address_Book_API#Components).
Use ctypes (http://docs.python.org/library/ctypes.html) to talk directly to libabook.
Both have advantages and disadvantages, and both are used in Hermes (http://hermes.garage.maemo.org/), see contacts.py and hermes.py for examples:
https://git.maemo.org/projects/hermes/?p=hermes;a=tree;f=package/src
falkontre
01-07-2010, 06:31 PM
Thank you very much for your answer.
I've read on the
http://pymaemo.garage.maemo.org/development.html
that exists a binding (version 0.1) for fremantle....maybe this info confused me.
I've already looked source code of Hermes, and in contact.py the author used abook as import statement...it's a different thing?
I'm so confused, sorry :)
Jaffa
01-07-2010, 06:50 PM
http://pymaemo.garage.maemo.org/development.html - that exists a binding (version 0.1) for fremantle....maybe this info confused me.
Oooh, exciting. That's new; I dunno if they've released it yet.
I've already looked source code of Hermes, and in contact.py the author[...]
...that's me :-)...
[...]used abook as import statement
Not that I can see. I was wrong, it doesn't use abook at the moment (it did in an earlier version). contacts.py uses ctypes to access the low-level C API of libebook (i.e. Evolution), due to limitations in python-evolution.
Whereas, hermes.py uses the "proper" Python API: python-evolution.
Sorry for any confusion. Anyway, you can access libabook via ctypes; I've done it in earlier versions of Hermes; but it's not very Pythonic.
aspidites
01-07-2010, 07:06 PM
Strange. There seem to be plenty of examples (http://pymaemo.garage.maemo.org/abook.html?highlight=abook) using abook, but nothing that explains which package abook is in.
falkontre
01-07-2010, 07:11 PM
Oh...let me say that your Hermes sounds very good... ;)
so we've to check if that binding has been released yet.
I was trying an approach without using C language because I'm a little afraid with it...I studied it a bit at college, but I became a Java fan with passing of time :)
Python is simpler for me (despite I never used it before today :) )
I'll use some of your tips to improve my maemo development experience.
Thank you for all.
Jaffa
01-08-2010, 08:16 AM
I'm a Java guy professionally, and Python is currently the best high-level OO language bet for Maemo and isn't dead-end when Qt comes along.
hartti
01-11-2010, 12:00 PM
When asked about this I was told that abook is for Maemo 4.x versions (even though this page http://pymaemo.garage.maemo.org/development.html incorrectly lists that API for Maemo 5). For now use ctypes (or check how Hermes does it :-)
Hartti
falkontre
01-11-2010, 12:52 PM
thank you for this info hartti...now that I know that no abook exist for fremantle,i'll concentrate on the use of ctypes.
Do you know if (and when) will be released it?
thank you
lizardo
01-11-2010, 02:34 PM
When asked about this I was told that abook is for Maemo 4.x versions (even though this page http://pymaemo.garage.maemo.org/development.html incorrectly lists that API for Maemo 5). For now use ctypes (or check how Hermes does it :-)
Exactly. That page was incorrect and, as part of a website reorganization, we moved the components descriptions to the wiki: http://wiki.maemo.org/PyMaemo/Components
Unfortunately I forgot to remove the old page as part of this. The link above now points to http://pymaemo.garage.maemo.org/docs.html.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.