Closed Aohzan closed 2 years ago
caldav documentation caldav source (message by IssueLinks)
Is it easily reproducible, and does the same error appear in the log all the time?
error appears at each HA start
I see the same error, although mine starts with Update for calendar.home fails
. Same TypeError about cannot pickle '_thread.lock' object
.
I found this error, 3 seconds before the log on the first post:
2022-05-05 13:35:49 ERROR (SyncWorker_8) [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 te
ll what server you are using
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/caldav/lib/error.py", line 25, in assert_
assert(condition)
AssertionError
That one is "mine" (from the python caldav library), I'll have a look
Uff, that traceback is unfortunately quite useless. I need to read up on how to log a proper traceback ...
There is an environmental variable PYTHON_CALDAV_DEBUGMODE
that can be adjusted, if setting it to DEBUG
there may be that there will be more information in the logs, but I don't know how to set environmental variables prior to starting HomeAssistant (it depends on how you're running it).
I have no idea about _thread.lock
, that's probably not coming from "my" library.
I edtited directly the lib/error.py
file:
debugmode = "DEBUG"
and now I don't have any calendar :grin:
2022-05-05 18:13:45 DEBUG (SyncWorker_7) [caldav] url: https://path/personal/
2022-05-05 18:13:45 DEBUG (SyncWorker_7) [caldav] self.url: https://path/mail/Calendar/personal/
2022-05-05 18:13:46 ERROR (MainThread) [homeassistant.components.calendar] Error while setting up caldav platform for calendar
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 87, in setup_platform
calendars = client.principal().calendars()
File "/usr/local/lib/python3.9/site-packages/caldav/davclient.py", line 350, in principal
self._principal = Principal(client=self, *largs, **kwargs)
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 399, in __init__
cup = self.get_property(dav.CurrentUserPrincipal())
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 174, in get_property
foo = self.get_properties([prop], **passthrough)
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 197, in get_properties
response = self._query_properties(props, depth)
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 141, in _query_properties
return self._query(root, depth)
File "/usr/local/lib/python3.9/site-packages/caldav/objects.py", line 159, in _query
ret = getattr(self.client, query_method)(
File "/usr/local/lib/python3.9/site-packages/caldav/davclient.py", line 398, in propfind
return self.request(url or self.url, "PROPFIND", props,
File "/usr/local/lib/python3.9/site-packages/caldav/davclient.py", line 577, in request
self.verify_login()
File "/usr/local/lib/python3.9/site-packages/caldav/davclient.py", line 543, in verify_login
error.assert_(auth_type in ('Basic', 'Digest'))
File "/usr/local/lib/python3.9/site-packages/caldav/lib/error.py", line 25, in assert_
assert(condition)
AssertionError
Aha. If you can manage to upgrade to caldav 0.9, this problem is fixed.
The error message above is the same as #65804 and several others. Regression in the 0.8.2-version of the python caldav library.
(Protocol error on the server side, it uses 'basic' or 'digest' rather than 'Basic' or 'Digest')
I upgraded to caldav 0.9, I don't have the Assertion error anymore, but still the original:
2022-05-06 11:48:06 ERROR (MainThread) [homeassistant.components.calendar] caldav: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 736, in async_device_update
await task
File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/src/homeassistant/homeassistant/components/caldav/calendar.py", line 146, in update
event = copy.deepcopy(self.data.event)
File "/usr/local/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/local/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/local/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.9/copy.py", line 264, in _reconstruct
y = func(*args)
File "/usr/local/lib/python3.9/copy.py", line 263, in <genexpr>
args = (deepcopy(arg, memo) for arg in args)
File "/usr/local/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/local/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/local/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.9/copy.py", line 205, in _deepcopy_list
append(deepcopy(a, memo))
File "/usr/local/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/local/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/local/lib/python3.9/copy.py", line 172, in deepcopy
y = _reconstruct(x, memo, *rv)
File "/usr/local/lib/python3.9/copy.py", line 270, in _reconstruct
state = deepcopy(state, memo)
File "/usr/local/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/usr/local/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/usr/local/lib/python3.9/copy.py", line 161, in deepcopy
rv = reductor(4)
TypeError: cannot pickle '_thread.lock' object
on the line event = copy.deepcopy(self.data.event)
where the error occurs, the content of self.data.event:
when the event is None it doesn't raise an error
This is probably outside what I can help with currently, haven't had time to look into the HomeAssistant caldav integration yet. But from the screen shot, I notice that the tzinfo class name looks a bit weird. If you're able to debug it interactively, try to replace it with zoneinfo.ZoneInfo(key='Europe/Paris')
and see if that solves the problem?
(the zoneinfo module is new in python 3.9 ... so there is a lot of mess with timezones in python at the moment, as pytz is considered "legacy")
I try to set to the value but if put tzicalvtz
back
I upgraded to caldav 0.9, I don't have the Assertion error anymore, but still the original:
Same here :(
With 2022.5.5 I have still the same issue... :(
I'm sorry if it seems like I've taken any kind of responsibility of this ticket.
There seems to be two different problems here, one is the error message Deviation from expectations found
reported by @Aohzan which is fixed in the caldav python library version 0.9.0, and which will be fixed in the next Home Assistant release.
Then there is another error TypeError: cannot pickle '_thread.lock' object
, which does not seem to be related to "my" python caldav library, but probably a bug in the Home Assistant caldav integration. I have a suspicion that the unpickable object is a timezone object. Someone with knowledge of the Home Assistant caldav code should probably look more into this.
For clarity my problem is this: TypeError: cannot pickle '_thread.lock' object
Same here :(
Somebody?
Since it looks like nobody of developers of caldav code of HASS is looking into this issue yet, I found a workaround to have voice notifications for events from my caldav calendars via Node-RED plug-in to HASS. It required some minor programming for proper parsing of early notifications like "!!-5" specified in event subjects, but in general it looks to be even more flexible solution.
The problem that it is not an option for me ;(
Problem is still present in 2022.6.0 :(
I don't get it. The code referred in traceback are old:
File "/srv/homeassistant-blue/lib/python3.9/site-packages/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity await entity.async_device_update(warning=False)
File "/srv/homeassistant-blue/lib/python3.9/site-packages/homeassistant/helpers/entity.py", line 736, in async_device_update await task
...
File "/srv/homeassistant-blue/lib/python3.9/site-packages/homeassistant/components/caldav/calendar.py", line 146, in update
Also I didn't change python.
This is the last commit: https://github.com/home-assistant/core/commit/f99b6004ea2dd0725483db7246672d468fe32088 as far as I can tell. It's huge: Showing 9 changed files with 342 additions and 182 deletions.
Workaround: copy back the old calendar.py
from here to homeassistant/components/caldav/
and restart homeassistant. Seems to work.
Maybe if I may ask @allenporter or @MartinHjelmare please could you check the last commit? Thank you!
I'll have a look.
Confirmed this version fixed the issue for me.
Thanks folks. This is tagged for the next patch release 2022.6.1
The problem
Since 2022.5 beta, I only have 2 of my 5 caldav calendars (
Travail XX
andVacances
from my yaml config)What version of Home Assistant Core has the issue?
2022.5.0b2
What was the last working version of Home Assistant Core?
2022.4.0
What type of installation are you running?
Home Assistant Supervised
Integration causing the issue
caldav
Link to integration documentation on our website
https://www.home-assistant.io/integrations/caldav/
Diagnostics information
No response
Example YAML snippet
Anything in the logs that might be useful for us?
Additional information
No response