导入ics数据python时出现问题

时间:2018-09-30 22:49:12

标签: python python-2.7 icalendar

我正在尝试使用icalendar将一些ics数据导入使用icalendar的python程序中。这是我的代码:

from icalendar import Calendar, Event
with open('sample.ics', 'r') as myfile:
data=myfile.read()
c = Calendar(data)

这给了我以下错误:

File "calparse.py", line 14, in <module>
    c = Calendar(data)
  File "/Library/Python/2.7/site-packages/icalendar/cal.py", line 82, in __init__
    super(Component, self).__init__(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/icalendar/caselessdict.py", line 33, in __init__
    super(CaselessDict, self).__init__(*args, **kwargs)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/collections.py", line 57, in __init__
    self.__update(*args, **kwds)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_abcoll.py", line 568, in update
    for key, value in other:
ValueError: need more than 1 value to unpack

关于如何解决此问题的任何建议都将得到广泛认可

0 个答案:

没有答案