HerHde / ical2mail

A Python3 script to fetch iCalendar/ical/ics-feeds from the web and send an email with upcoming events.
Other
0 stars 0 forks source link

Error with recurring all-day dates #1

Open HerHde opened 7 years ago

HerHde commented 7 years ago

When I'm trying to parse a file which has recurring full-day events the following error occurs:

Traceback (most recent call last):
  File "ical2mail.py", line 260, in <module>
    main()
  File "ical2mail.py", line 247, in main
    events += parse_ics(url)
  File "ical2mail.py", line 101, in parse_ics
    for dtstart_rec in rule.between(DATE_MIN - timedelta(microseconds=1), DATE_MAX):
  File "/[...]/ical2mail/venv/lib/python3.6/site-packages/dateutil/rrule.py", line 290, in between
    for i in gen:
  File "/[...]/ical2mail/venv/lib/python3.6/site-packages/dateutil/rrule.py", line 861, in _iter
    if until and res > until:
TypeError: can't compare offset-naive and offset-aware datetimes

It may be related to dateutil/dateutil#348, but further investigation is necessary.

HerHde commented 7 years ago

Found the problem: The event that crashed the script has the following rrule:

RRULE:FREQ=WEEKLY;UNTIL=20160125

where the UNTIL has no timezone and is therefore offset-naive. Changing it to

RRULE:FREQ=WEEKLY;UNTIL=20160125T000000Z

solves the crash.