prometheus42 / libreoffice-ical-importer

Simple extension for LibreOffice for importing iCalendar files (.ics) into LibreOffice Calc.
MIT License
4 stars 3 forks source link

ValueError: A VEVENT must have at most one CATEGORIES - Why aren't multiple categories supported? #2

Closed Johann-Tree closed 1 year ago

Johann-Tree commented 1 year ago

I figured I can use ical2csv.py directly from command line so I tried converting a calendar exported by Thunderbird. After some processing time I get following error:

src/ical2csv.py ~/Dokumente/Privat.ics Writing to CSV file: /home/me/Dokumente/Privat.ics.csv Reading iCalendar file... Traceback (most recent call last): File "src/ical2csv.py", line 91, in convert_ical_file() File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1130, in call return self.main(args, kwargs) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1055, in main rv = self.invoke(ctx) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/click/core.py", line 760, in invoke return __callback(args, **kwargs) File "src/ical2csv.py", line 66, in convert_ical_file write_csv_file(read_ical_file(icalendar_file), csv_file) File "src/ical2csv.py", line 24, in read_ical_file c = Calendar(calendar_file.read()) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/icalendar.py", line 69, in init self._populate(containers[0]) # Use first calendar File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 59, in _populate parser(self, lines) # Send a list or empty list File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/parsers/icalendar_parser.py", line 71, in parse_vevent calendar.events = set(map(event_factory, lines)) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/parsers/icalendar_parser.py", line 69, in event_factory return Event._from_container(x, tz=calendar._timezones) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 31, in _from_container k._populate(container) File "/home/me/Downloads/programme/libreoffice-ical-importer/LO-ICAL/lib/python3.8/site-packages/ics/component.py", line 54, in _populate raise ValueError( ValueError: A VEVENT must have at most one CATEGORIES

Why are multiple categories not supported? Ics-py seems able to process them. I also checked my .ics file: All events have at most one category…

I also opened an issue there: https://github.com/ics-py/ics-py/issues/373

prometheus42 commented 1 year ago

I did not have that problem, but I did not check every feature of ICS files, because this was a simple project for one time use. If there is a simple solution I could implement it?! I would have to look further into the issue.

prometheus42 commented 1 year ago

Short addition: I changed the code (0e202914e64e48be4034db5f306ef89ee127dabf) to output a list if a set of values comes from the ICS file. Please test your calendar file with the newest version.