我使用python/caldav和python/icalendar将日历事件添加到我的caldav日历中。
阅读事件和日历可以顺利运行。
现在我从一个ics文件中获取一个事件并尝试将其添加到我的caldav日历中。
meetings = icalendar.Calendar.from_ical(ics-file)
for event in meetings.walk():
if event.name == "VEVENT":
ical = event.to_ical()
print(ical)
my_caldav_calendar.add_event(ical)
然而,这导致我出现以下错误:
Traceback (most recent call last):
File "vss_filter.py", line 45, in <module>
my_caldav_calendar.add_event(ical)
File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 422, in add_event
return Event(self.client, data = ical, parent = self).save()
File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 718, in save
self._create(self._instance.serialize(), self.id, path)
File "/usr/local/lib/python2.7/site-packages/caldav/objects.py", line 696, in _create
path = id + ".ics"
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
ical-event明显有一个字段'UID',如图所示:
BEGIN:VEVENT
SUMMARY:event-title
DTSTART;TZID=Europe/Warsaw:20150305T130000
DTEND;TZID=Europe/Warsaw:20150305T140000
DTSTAMP:20150624T170317Z
UID:9149F870-5475-4120-9EE5-1A06E857807B
SEQUENCE:1
EXDATE;TZID=Europe/Warsaw:20150618T130000
EXDATE;TZID=Europe/Warsaw:20150305T130000
EXDATE;TZID=Europe/Warsaw:20150430T130000
CREATED:20150226T105018Z
DESCRIPTION:
LAST-MODIFIED:20150616T094907Z
LOCATION:
RRULE:FREQ=WEEKLY;UNTIL=20150624T235959Z;INTERVAL=1
STATUS:CONFIRMED
TRANSP:OPAQUE
BEGIN:VALARM
ACTION:NONE
TRIGGER;VALUE=DATE-TIME:19760401T005545Z
UID:FC67F59E-5540-47BE-ACFA-FE229771EC11
X-WR-ALARMUID:FC67F59E-5540-47BE-ACFA-FE229771EC11
END:VALARM
END:VEVENT
所以应该有一个id python / caldav可以找到。 为什么这个失败的单桅帆船能解决它?