简体   繁体   English

关于Python PalmDB库的任何教程吗?

[英]Any tutorial for Python PalmDB library?

I've downloaded the Python PalmDB lib, but can't find any info on how to use it. 我已经下载了Python PalmDB库,但是找不到有关如何使用它的任何信息。 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. 这给了我一个记录(?)的xml表示形式,它带有一些讨厌的长payload属性,这对我来说不像任何人类可读的文本。 I just want to read the contents of the pdb file. 我只想阅读pdb文件的内容。 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? 您会怎么做才能找到在我所处的情况下完成工作的正确方法?

There are two problems with the PalmDB module. PalmDB模块有两个问题。 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. 我相信程序包作者使用ToDo格式做了一些工作,但据我所知,其他人都没有。 What I needed was something to unpack Palm address records, so I rolled my own module. 我需要解压缩Palm地址记录的东西,所以我推出了自己的模块。 I posted it [1] so you can take a look get an idea of what's involved. 我将其发布[1],以便您可以大致了解其中涉及的内容。 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. 我是几年前创建的,所以我不记得要做的所有细节了,但是我确实对其进行了更新,以与PalmDB的当前版本[2]一起使用,该版本使用旧版本完全破坏了所有代码。 Hope it's useful! 希望它有用!

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM