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

Decoding categories throws AssertionError #279

Open
chris246 opened this issue Dec 15, 2018 · 1 comment
Open

Decoding categories throws AssertionError #279

chris246 opened this issue Dec 15, 2018 · 1 comment

Comments

@chris246
Copy link

chris246 commented Dec 15, 2018

When decoding categories from an ical feed, an AssertionError is thrown:
component.decoded('categories', [])
Stacktrace:

File "\lib\site-packages\icalendar\cal.py", line 237, in decoded
    return self._decode(name, value)
  File "\lib\site-packages\icalendar\cal.py", line 220, in _decode
    decoded = types_factory.from_ical(name, value)
  File "\lib\site-packages\icalendar\prop.py", line 1042, in from_ical
    decoded = type_class.from_ical(value)
  File "\lib\site-packages\icalendar\prop.py", line 282, in from_ical
    out = unescape_char(ical).split(",")
  File "\lib\site-packages\icalendar\parser.py", line 34, in unescape_char
    assert isinstance(text, (compat.unicode_type, compat.bytes_type))
AssertionError

The type of ical in file prop.py vCategory.from_ical (line 281) is icalendar.prop.vCategory

Using component.get('categories', []) works

icalender version: 4.0.3

@swolebro
Copy link

Without seeing your .ics file, I can't say for certain how you're reaching that assertion, but I'm 95% confident it's related to the changes in 20e09f3, which created a designated class for VCATEGORY fields, whereas before they were simple strings. Reverting to icalendar==4.0.2 would likely fix the issue until it gets resolved here.

This bug in a client application seems to stem from the same: pimutils/khal#823

NB: Not a developer of this library, just a new user of Khal debugging my own issues with it.

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