我正在尝试一个日历服务器,我选择了达尔文的开源日历服务器作为服务器。我遵循了Quick start页面中提到的步骤,我能够让服务器运行。在
然后我编写了以下python脚本来保存一个日历事件
from datetime import datetime
import caldav
from caldav.elements import dav, cdav
# Caldav url
url = "http://apprentice:apprentice@localhost:8008/calendars/users/apprentice/calendar/"
vcal = """BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VEVENT
UID:1234567890
DTSTAMP:20100510T182145Z
DTSTART:20100512T170000Z
DTEND:20100512T180000Z
SUMMARY:This is an event
END:VEVENT
END:VCALENDAR
"""
client = caldav.DAVClient(url)
principal = caldav.Principal(client)
calendars = principal.calendars()
if len(calendars) > 0:
calendar = calendars[0]
print "Using calendar", calendar
print "Renaming"
calendar.set_properties([dav.DisplayName("Test calendar"),])
print calendar.get_properties([dav.DisplayName(),])
event = calendar.add_event(vcal)
print "Event", event, "created"
print "Looking for events in 2010-05"
results = calendar.date_search(
datetime(2010, 5, 1), datetime(2010, 6, 1))
for event in results:
print "Found", event
我得到了以下错误
File "nodesets.py", line 22, in principal = caldav.Principal(client) File "/Library/Python/2.7/site-packages/caldav/objects.py", line 256, in init cup = self.get_properties([dav.CurrentUserPrincipal()]) File "/Library/Python/2.7/site-packages/caldav/objects.py", line 151, in get_properties raise Exception("The CalDAV server you are using has " Exception: The CalDAV server you are using has a problem with path handling.
你知道我做错什么了吗?在
谢谢
我会从尝试开始
相关问题 更多 >
编程相关推荐