Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KeyError: 'ENCODING' #40

Closed
jelmer opened this issue Sep 4, 2016 · 5 comments
Closed

KeyError: 'ENCODING' #40

jelmer opened this issue Sep 4, 2016 · 5 comments

Comments

@jelmer
Copy link
Contributor

jelmer commented Sep 4, 2016

Recent changes mean some vcf files now fail to parse

[Sun Sep 04 17:15:29.244163 2016] [wsgi:error] [pid 24799] Traceback (most recent call last):
[Sun Sep 04 17:15:29.244206 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/calypso/calypso/webdav.py", line 270, in insert_file
[Sun Sep 04 17:15:29.244245 2016] [wsgi:error] [pid 24799]     item = self.read_file(path)
[Sun Sep 04 17:15:29.244283 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/calypso/calypso/webdav.py", line 265, in read_file
[Sun Sep 04 17:15:29.244335 2016] [wsgi:error] [pid 24799]     item = Item(text, None, path, self.urlpath)
[Sun Sep 04 17:15:29.244375 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/calypso/calypso/webdav.py", line 80, in **init**
[Sun Sep 04 17:15:29.244412 2016] [wsgi:error] [pid 24799]     self.object = vobject.readOne(text)
[Sun Sep 04 17:15:29.244451 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/vobject/vobject/base.py", line 1130, in readOne
[Sun Sep 04 17:15:29.244494 2016] [wsgi:error] [pid 24799]     allowQP))
[Sun Sep 04 17:15:29.244523 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/vobject/vobject/base.py", line 1074, in readComponents
[Sun Sep 04 17:15:29.244548 2016] [wsgi:error] [pid 24799]     vline = textLineToContentLine(line, n)
[Sun Sep 04 17:15:29.244571 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/vobject/vobject/base.py", line 913, in textLineToContentLine
[Sun Sep 04 17:15:29.244595 2016] [wsgi:error] [pid 24799]     'lineNumber' : n})
[Sun Sep 04 17:15:29.244619 2016] [wsgi:error] [pid 24799]   File "/home/jelmer/vobject/vobject/base.py", line 337, in **init**
[Sun Sep 04 17:15:29.244643 2016] [wsgi:error] [pid 24799]     self.value = codecs.decode(self.value.encode("utf-8"), "quoted-printable").decode(self.params['ENCODING'])
KeyError: 'ENCODING'

This makes sense when reading the code. In base.py:330, if 'ENCODING' is set to just 'QUOTED-PRINTABLE', that item is first removed from the list and then 'ENCODING' itself is removed because it is empty.

@jelmer
Copy link
Contributor Author

jelmer commented Sep 4, 2016

This seems to be a regression from 53fb317

@jelmer
Copy link
Contributor Author

jelmer commented Sep 4, 2016

And similarly, if 'QUOTED-PRINTABLE' as a singletonparam is set, 'ENCODING' can not be set at all.

@jelmer
Copy link
Contributor Author

jelmer commented Dec 6, 2016

I think this is also fixed after #41 was merged?

@wpercy
Copy link
Contributor

wpercy commented Dec 6, 2016

Yep just want to run some tests

@wpercy
Copy link
Contributor

wpercy commented Dec 6, 2016

resolved by #49

@wpercy wpercy closed this as completed Dec 6, 2016
lucc pushed a commit to lucc/vobject that referenced this issue Aug 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants