1

I have a Vcard string and I want to transform it to a Vobject : I did the following and I got the mentioned error , my question is what is this error and how can I transform a string to a vcard object?

    my_str = "BEGIN:VCARD
              VERSION:3.0
              N;CHARSET=UTF-8:ContactName;;;;
              TEL:0000000000
              END:VCARD"
   vcard = vobject.readOne(my_str)

stack trace:

error: Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 1156, in readOne
    allowQP))
  File "/usr/local/lib/python2.7/dist-packages/vobject/base.py", line 1142, in readComponents
    (stack.topName())), n)
vobject.base.ParseError: At line 1: Component VCARD was never closed
LoneWanderer
  • 3,058
  • 1
  • 23
  • 41
NEW_user 2020
  • 45
  • 1
  • 7
  • Try to define your string `my_str` with triple quotes. Those will keep the line feeds `\n`. This is how it is written in the documentation http://eventable.github.io/vobject, in part "Parsing vCard objects". I guess each entry should be in a different line. – Frodon Nov 25 '20 at 00:18

0 Answers0