[jp] Possible to jpilot-dump a ContactsDB?

Nicholas Piper nick-moongroup at nickpiper.co.uk
Tue Sep 15 05:23:35 EDT 2009


On Mon, 14 Sep 2009, Ng Oon-Ee wrote:

> Is it possible to use jpilot-dump on a ContactsDB database? Wish to
> script a regular export of my jpilot contact list (which is in a
> ContactsDB, from my Centro) to evolution, the rest of the scripting is
> easy (basically string adjustment using sed), but I still have to
> manually export a csv from jpilot instead of being able to just use
> jpilot-dump as I can for memos and calendars.

You can do this from Python, if you got jppy working. (I'm the author
of jppy, and it's been a little broken recently.)

Here's an example, using the current Jppy API. Older versions are a
tiny bit different as they don't have an 'environment' object.


import jppy
import csv
import sys

env = jppy.environment.Environment()

csvWriter = csv.writer(open('/tmp/addresses.csv', 'w'), delimiter=',',
                       quotechar='"', quoting=csv.QUOTE_MINIMAL)

# this uses ContactsDB, depending on your ~/.jppyrc:
# [jppy]
# addressbook = jppy.jpilot.modern.addressBook
# #addressbook = jppy.jpilot.legacy.addressBook

for record in env.addressBook.records():
    details = []
    # python csv module doesn't support unicode :-(


As you have full Python available, you might decide not to use a
temporary CSV file and instead go straight to evolution with some
Python bindings.

(Hmm, maybe I should have written a Conduit plugin for jpilot by now?)


More information about the Jpilot mailing list