|
|
2011-05-26
, 08:46
|
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#22
|
| The Following User Says Thank You to nicolai For This Useful Post: | ||
|
|
2011-05-26
, 08:51
|
|
Posts: 37 |
Thanked: 18 times |
Joined on Apr 2010
|
#23
|
|
|
2011-07-13
, 18:42
|
|
|
Posts: 1,455 |
Thanked: 3,309 times |
Joined on Dec 2009
@ Rochester, NY
|
#25
|
|
|
2011-09-28
, 06:13
|
|
Posts: 129 |
Thanked: 32 times |
Joined on Jun 2010
|
#26
|
|
|
2012-12-17
, 12:22
|
|
Posts: 2 |
Thanked: 7 times |
Joined on Dec 2012
|
#27
|
#!/usr/bin/env python
#
# Please let me know if this works without python-gnome2 installed!
#
USE='Use: addressbook add_contact given-name=John family-name=Doe email-1=johndoe@example.com'
import os
import sys
import evolution
def quit( message):
sys.stderr.write("%s\n"% message)
exit( 1)
if 0 == os.getuid():
quit('Not as root please')
adb = evolution.ebook.open_addressbook('default')
# Not listing contact because already covered: http://maemo.cloud-7.de/maemo5/usr/local/bin/contact
#def list_contacts( args):
# for contact in adb.get_all_contacts():
# print [contact.get_property(ppt) for ppt in ['full-name', 'mobile-phone']]
if len( sys.argv) < 3 or sys.argv[1] != 'add_contact':
quit( USE)
ct = evolution.ebook.EContact()
for arg in sys.argv[2:]:
name, value = arg.split('=')
ct.set_property( name, value)
adb.add_contact( ct)
| The Following User Says Thank You to unclouded For This Useful Post: | ||
|
|
2013-11-21
, 11:30
|
|
Posts: 1 |
Thanked: 0 times |
Joined on Nov 2013
|
#28
|
/home/user/scripts# python contact_search.py -f 'Firstname Lastname' -l Traceback (most recent call last): File "contact_search.py", line 55, in <module> main() File "contact_search.py", line 52, in main search_contact(options) File "contact_search.py", line 13, in search_contact for c in ebook.get_all_contacts(): AttributeError: 'NoneType' object has no attribute 'get_all_contacts'