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

SEQUENCE: in VTIMEZONE causes backtrace #90

Closed
wom-bat opened this issue Oct 5, 2016 · 4 comments
Closed

SEQUENCE: in VTIMEZONE causes backtrace #90

wom-bat opened this issue Oct 5, 2016 · 4 comments
Labels

Comments

@wom-bat
Copy link

wom-bat commented Oct 5, 2016

I have an ics feed from Confluence. It contains things like:

BEGIN:VTIMEZONE
TZID:Australia/Sydney
TZURL:http://tzurl.org/zoneinfo/Australia/Sydney
SEQUENCE:498
SEQUENCE:498
BEGIN:STANDARD
TZOFFSETFROM:+1100
TZOFFSETTO:+1000
TZNAME:EST
DTSTART:20080406T030000
RRULE:FREQ=YEARLY;BYMONTH=4;BYDAY=1SU
END:STANDARD

which causes a python backtrace an d error:

` File "./icsfeed.py", line 36, in get_todays_events
    c = Calendar(urlopen(url).read().decode('iso-8859-1'))
  File "/usr/local/lib/python2.7/dist-packages/ics/icalendar.py", line 71, in __init__
    self._populate(container[0])  # Use first calendar
  File "/usr/local/lib/python2.7/dist-packages/ics/component.py", line 52, in _populate
    extractor.function(self, lines)  # Send a list or empty list
  File "/usr/local/lib/python2.7/dist-packages/ics/icalendar.py", line 223, in timezone
    timezones = tzical(fake_file)  # tzical does not like strings
  File "/usr/lib/python2.7/dist-packages/dateutil/tz/tz.py", line 748, in __init__
    self._parse_rfc(fileobj.read())
  File "/usr/lib/python2.7/dist-packages/dateutil/tz/tz.py", line 891, in _parse_rfc
    raise ValueError("unsupported property: "+name)
ValueError: unsupported property: SEQUENCE
@ksalman
Copy link

ksalman commented Apr 3, 2018

I am also seeing this issue.

@jc1518
Copy link

jc1518 commented Jun 8, 2018

me too.

@snoopyjc
Copy link

snoopyjc commented Jul 3, 2019

Same here!!! Any avoidance?

@snoopyjc
Copy link

snoopyjc commented Jul 3, 2019

Avoidance: Send text thru this before feeding to Calendar():

@staticmethod
def _remove_sequence_from_vtimezone(text):   # Avoid BUG: https://github.com/C4ptainCrunch/ics.py/issues/90
    result = ''
    lines = text.split('\n')
    in_vt = False
    for i in reversed(range(len(lines))):
        line = lines[i]
        if in_vt:
            if line.startswith('SEQUENCE:'):
                #print(f'del SEQUENCE at line {i}')
                del lines[i]
            elif line.startswith('BEGIN:VTIMEZONE'):
                #print(f'not in_vt at line {i}')
                in_vt = False
        elif line.startswith('END:VTIMEZONE'):
            #print(f'in_vt at line {i}')
            in_vt = True
    return '\n'.join(lines)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants