views:

91

answers:

1

Hello, I've downloaded the Python PalmDB lib, but can't find any info on how to use it. I've tried reading docstrings and so far I've been able to come up with the following code:

from pprint import pprint
from PalmDB.PalmDatabase import PalmDatabase

pdb = PalmDatabase()

with open('testdb.pdb','rb') as data:
    pdb.fromByteArray(data.read())

pprint(dir(pdb))
pprint(pdb.attributes)
print pdb.__doc__

#print pdb.records

print pdb.records[10].toXML()

which gives me the xml representation of a record (?) with some nasty long payload attribute, which doesn't resemble any kind of human-readable text to me. I just want to read the contents of the pdb file. Is there a guide/tutorial for this library? What would you do to figure out the proper way to make things done in my situation?

+1  A: 

There are two problems with the PalmDB module. The first is that it comes with almost no documentation. The other is that in order to do anything useful with the records in the database you need to figure out the binary structure for the particular record type you're dealing with (it's different for each type) and unpack it yourself. I believe the package author did some work with the ToDo format, but none of the others as far as I know. What I needed was something to unpack Palm address records, so I rolled my own module. I posted it [1] so you can take a look get an idea of what's involved. If it's the address book records you're interested in, you're in luck. I created it several years ago, so I don't remember all the details of what I had to do, but I did update it to work with the current version [2] of PalmDB, which completely broke all code using older versions. Hope it's useful!

[1] http://pastebin.com/f75a93f48 [2] 1.8.1

Bob Kline