python-caldav / caldav

Apache License 2.0
319 stars 94 forks source link

Deviation from expectations found for davmail 6.0.1 #209

Open tubaman opened 2 years ago

tubaman commented 2 years ago
ERROR:caldav:Deviation from expectations found.  Please raise an issue at https://github.com/python-caldav/caldav/issues or reach out to t-caldav@tobixen.no, include this error and the traceback and tell what server you are using
Traceback (most recent call last):
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/lib/error.py", line 26, in assert_
    assert(condition)
AssertionError

caldav version: 661785b

tobixen commented 2 years ago

Unfortunately the traceback is useless - should probably find some way to improve on that.

If you set environmental variable PYTHON_CALDAV_DEBUGMODE to DEBUG it will throw a proper error instead of just logging the error .... and if you set it to DEBUG_PDB you will get throwin into the debugger.

tubaman commented 2 years ago

Traceback with PYTHON_CALDAV_DEBUGMODE=DEBUG:

Traceback (most recent call last):
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 216, in <module>
    sys.exit(main())
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 212, in main
    syncfrompto()
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 184, in syncfrompto
    calendar_pto_events = set(get_our_pto_events())
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 145, in get_our_pto_events
    our_calendar_pto_events = [e for e in calendar_pto_events if e.organizer in direct_reports]
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 145, in <listcomp>
    our_calendar_pto_events = [e for e in calendar_pto_events if e.organizer in direct_reports]
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 101, in get_pto_events
    cal_events = get_events()
  File "/Users/myuser/sandboxes/myproject/./syncfromptocalendar", line 42, in get_events
    return calendar.date_search(start=start, end=end, expand=False)
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/objects.py", line 750, in date_search
    objects = self.search(root, comp_class)
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/objects.py", line 812, in search
    (response, objects) = self._request_report_build_resultlist(xml, comp_class)
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/objects.py", line 780, in _request_report_build_resultlist
    results = response.expand_simple_props(props_)
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/davclient.py", line 269, in expand_simple_props
    props_found[prop.tag] = self._expand_simple_prop(prop.tag, props_found, xpath=xpath)
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/davclient.py", line 232, in _expand_simple_prop
    error.assert_(not prop_xml.items())
  File "/Users/myuser/.virtualenvs/myproject/lib/python3.10/site-packages/caldav/lib/error.py", line 26, in assert_
    assert(condition)
AssertionError
tobixen commented 2 years ago

Interesting - your server returns more data than expected. It's probably not against the RFC, hence an assert here is probably not quite right, but at the other hand it would be nice to check up that the library is not ignoring anything important. Could you fish out the XML for me? Either through the debugger or by injecting some logging directly into davclient.py. The XML should be available as self.raw from the DAVResponse class.