You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm getting parsing errors that seemed to be linked to the syntax of the images in the vcard. Out of 6 images that I've checked (from vcards that were retrieved from a davical server using vdirsyncer) four failed to parse and two parsed without any issue. I discovered this when using khard to search the vcf files. I originally reported this to the khard developer on his github page. He reviewed the issue and suggested that I report it here as he suspects it's an issue with vobject. The two syntaxs are as follows:
import vobject
file = "./whatever.vcf"
with open(file) as f:
vcard = vobject.readOne(f)
with open(file) as f:
raw = f.read()
print(vcard.serialize())
print(raw)
In the cases where the parsing fails this is the output:
Traceback (most recent call last):
File "/usr/lib/python3.8/encodings/base64_codec.py", line 19, in base64_decode
return (base64.decodebytes(input), len(input))
File "/usr/lib/python3.8/base64.py", line 546, in decodebytes
return binascii.a2b_base64(s)
binascii.Error: Incorrect padding
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./vcardtest.py", line 6, in <module>
vcard = vobject.readOne(f)
File "/usr/lib/python3/dist-packages/vobject/base.py", line 1155, in readOne
return next(readComponents(stream, validate, transform, ignoreUnreadable,
File "/usr/lib/python3/dist-packages/vobject/base.py", line 1120, in readComponents
component.setBehaviorFromVersionLine(versionLine)
File "/usr/lib/python3/dist-packages/vobject/base.py", line 663, in setBehaviorFromVersionLine
self.setBehavior(v)
File "/usr/lib/python3/dist-packages/vobject/base.py", line 170, in setBehavior
obj.autoBehavior(True)
File "/usr/lib/python3/dist-packages/vobject/base.py", line 156, in autoBehavior
self.behavior.decode(self)
File "/usr/lib/python3/dist-packages/vobject/vcard.py", line 143, in decode
line.value = codecs.decode(line.value.encode("utf-8"), "base64")
binascii.Error: decoding with 'base64' codec failed (Error: Incorrect padding)
If this is a vobject issue, Is there any way to work around it?
The text was updated successfully, but these errors were encountered:
I'm getting parsing errors that seemed to be linked to the syntax of the images in the vcard. Out of 6 images that I've checked (from vcards that were retrieved from a davical server using vdirsyncer) four failed to parse and two parsed without any issue. I discovered this when using khard to search the vcf files. I originally reported this to the khard developer on his github page. He reviewed the issue and suggested that I report it here as he suspects it's an issue with vobject. The two syntaxs are as follows:
I'm using this script to do the test:
In the cases where the parsing fails this is the output:
If this is a vobject issue, Is there any way to work around it?
The text was updated successfully, but these errors were encountered: