[Vobject] how to parse street addresses with vobject?

Bill Janssen janssen at parc.com
Mon Jan 12 19:09:32 CST 2009


Hi, Jeffrey.  I downloaded and installed 0.8.1, and read through your
thread.  However, dense as I am, I still don't see how to get a
structured value for the address.

>>> c = vobject.readOne(open("/project/uplib/samples/vcard/dummy.vcf", "r"))
>>> c
<VCARD| [<ADR{u'TYPE': [u'HOME', u'PREF']};;5690 N. Dexter Ave.;San Francisco;CA;93205;>, <EMAIL{u'TYPE': [u'INTERNET', u'HOME', u'PREF']}alice at alumni.mit.edu>, <EMAIL{u'TYPE': [u'INTERNET', u'WORK', u'PREF']}bob at eink.com>, <EMAIL{u'TYPE': [u'INTERNET', u'HOME']}bob at alumni.mit.edu>, <FN{}Bob & Alice Dummy>, <N{}Dummy;Bob & Alice;;;>, <ORG{}Dummy Corporation Example, International>, <TEL{u'TYPE': [u'HOME', u'PREF']}(415) 461-7238>, <X-ABADR{}us>, <X-ABUID{}E4BF817A-BF92-11D6-882C-00306583F524\=3AABPerson>]>
>>> c.adr.value
u';;5690 N. Dexter Ave.;San Francisco;CA;93205;'
>>> type(c.adr.value)
<type 'unicode'>
>>> 

I'm still getting ContentLine instances instead of Name, Address, etc.

Bill

Jeffrey Harris <jeffrey at osafoundation.org> wrote:

> Hi Bill,
> 
> > I'd like to get that as a structured value, so that I can ask for
> > street, city, etc.  Is there a way to do this?
> 
> Yes.  See this thread:
> 
> http://skyhouseconsulting.markmail.org/message/dzmyemjp52ynut2i
> 
> The problem is that your vcard doesn't have a VERSION, so it's
> technically not valid.
> 
> vobject should fall back to its VCARD 3.0 behavior, but it doesn't.  Two
> requests to explain this in a week, however, convinced me to fix it.
> This is fixed in vobject 0.8.1, just released.
> 
> Sincerely,
> Jeffrey
> _______________________________________________
> VObject mailing list
> VObject at lists.skyhouseconsulting.com
> http://lists.skyhouseconsulting.com/mailman/listinfo/vobject


More information about the VObject mailing list