pythoncaldav

Python caldav Attribute Error


I just installed caldav 0.5.0 using pip on Windows. I tried to use this code from the documentation:

from datetime import datetime
import caldav
from caldav.elements import dav, cdav

# Caldav url
url = "https://user:pass@hostname/caldav.php/"

client = caldav.DAVClient(url)

But I get this error:

AttributeError: module 'caldav' has no attribute 'DAVClient'

Does someone know what causes this issue?


Solution

  • It is because your file is named calendar.py, which causes some kind of collision somewhere. Renaming your file to something else will do the trick (it did for me).