Python icalendar没有属性“;来自“U字符串”;

Python icalendar没有属性“;来自“U字符串”;,python,Python,我正在尝试运行一个脚本(我发现)来读取.ics文件(我从谷歌日历中获得)。代码如下: from icalendar import Calendar import urllib ics = urllib.urlopen('http://www.google.com/calendarlink/basic.ics').read() ical=Calendar.from_string(ics) for vevent in ical.subcomponents: if vevent.name != "

我正在尝试运行一个脚本(我发现)来读取.ics文件(我从谷歌日历中获得)。代码如下:

from icalendar import Calendar
import urllib
ics = urllib.urlopen('http://www.google.com/calendarlink/basic.ics').read()
ical=Calendar.from_string(ics)
for vevent in ical.subcomponents:
  if vevent.name != "VEVENT":
    continue
  title = str(vevent.get('SUMMARY'))
  description = str(vevent.get('DESCRIPTION'))
  location = str(vevent.get('LOCATION'))
  start = vevent.get('DTSTART').dt      # a datetime
  end = vevent.get('DTEND').dt        # a datetime
我通过easy_install安装了icalendar,但在运行scrpt时,出现以下错误:

C:\python test>c:\Python27\python.exe google-calendar-test.py
Traceback (most recent call last):
  File "google-calendar-test.py", line 4, in <module>
    ical = Calendar.from_string(ics)
AttributeError: type object 'Calendar' has no attribute 'from_string'
C:\python-test>C:\Python27\python.exe google-calendar-test.py
回溯(最近一次呼叫最后一次):
文件“googlecalendar test.py”,第4行,在
ical=日历。从字符串(ics)
AttributeError:类型对象“日历”没有“来自字符串”的属性

我还没有在linux上测试它,但我相信它会在那里工作。。。几个月前,我对另一个包裹也有同样的问题。好像是个虫子?有人有主意了吗?

根据文件,
日历。从字符串开始。再往下一点,你就可以使用日历了