Deleting the contact database
Hello to all,
recently I started to code a python program to import vcards into the phonebook. This worked out very nice, and it's a very simple way for me to get my address data from Linux on my phone. During this I stumbled upon this:
If I delete my phonebook with the following code, the phonebook "seems" to get empty (f.ex. there are no contacts anymore to dial/send a sms to), but the database file in c:\system\data\contacts.cdb grows and grows instead of becoming smaller. After several runs this file grew to 1.6MB and almost killed my phone...
I hope anyone spots the error in this code so my program becomes usable:
import contacts
db = contacts.open()
allkeys = db.keys()
for i in allkeys:
del db[i]
db.close()
If I use the symbian phonebook instead of my code and delete the addresses, the file gets small again (f.ex. from 1.6MB to 35KB while deleting 50 contacts).
Thanks for your help, it's very much appreciated,
Joost
Re: Deleting the contact database
[QUOTE][i]Originally posted by sx1freak [/i]
[B]Hello to all,
recently I started to code a python program to import vcards into the phonebook. This worked out very nice, and it's a very simple way for me to get my address data from Linux on my phone. During this I stumbled upon this:
If I delete my phonebook with the following code, the phonebook "seems" to get empty (f.ex. there are no contacts anymore to dial/send a sms to), but the database file in c:\system\data\contacts.cdb grows and grows instead of becoming smaller. After several runs this file grew to 1.6MB and almost killed my phone...
I hope anyone spots the error in this code so my program becomes usable:
import contacts
db = contacts.open()
allkeys = db.keys()
for i in allkeys:
del db[i]
db.close()
If I use the symbian phonebook instead of my code and delete the addresses, the file gets small again (f.ex. from 1.6MB to 35KB while deleting 50 contacts).
Thanks for your help, it's very much appreciated,
Joost [/B][/QUOTE]
-thank you for your note! in the next release the contacts extension will have compact() and compact_required() - methods which should solve this problem.