[Vobject] How to split name values?

Steffen Siebert vobject at steffensiebert.de
Wed Jun 11 04:06:22 CDT 2008


Jeffrey Harris schrieb:

> You did everything right, except that you're using a version 2.1 vcard. 

Hi,

thanks for your response.

If I set the behaviour as you've suggested (or set the version tag to 
3.0 in the vCard), the n attribute gets the name behavior, but 
unfortunatly "print card.n.given" still raises an AttributeError.

When executing:

VCARD = """BEGIN:VCARD
VERSION:2.1
N:Siebert;Steffen
FN:Steffen Siebert
END:VCARD
"""
import vobject

card = vobject.readOne(VCARD)
card.setBehavior(vobject.vcard.VCard3_0, True)
print card.n.value
print card.n.behavior
print card.n.given

I receive:

Siebert;Steffen
<class 'vobject.vcard.NameBehavior'>
Traceback (most recent call last):
   File 
"/home/siebert/workspace/snom8xx/phone/AppServer/scratch/vCard.py", line 
37, in <module>
     print card.n.given
   File 
"/home/siebert/workspace/snom8xx/phone/PyLib/vobject-0.6.6-py2.5.egg/vobject/base.py", 
line 309, in __getattr__
     raise exceptions.AttributeError, name
AttributeError: given


What is going wrong here?

Ciao,
   Steffen


More information about the VObject mailing list