CSS Filter "AttributeError: 'CSSSelector' object has no attribute 'evaluate'"
jamesquilty opened this issue · 2 comments
I have urlwatch running on an Arch Linux server for which I'm not sysadmin. An update/upgrade was applied over the weekend of 13-14 Jan which has caused jobs with CSS filters to generate tracebacks
Traceback (most recent call last):
File "/home/username/.local/lib/python3.10/site-packages/urlwatch/handler.py", line 120, in process
data = FilterBase.process(filter_kind, subfilter, self, data)
File "/home/username/.local/lib/python3.10/site-packages/urlwatch/filters.py", line 188, in process
return filtercls(state.job, state).filter(data, subfilter)
File "/home/username/.local/lib/python3.10/site-packages/urlwatch/filters.py", line 810, in filter
return lxml_parser.get_filtered_data()
File "/home/username/.local/lib/python3.10/site-packages/urlwatch/filters.py", line 776, in get_filtered_data
elements = list(self._get_filtered_elements())
File "/home/username/.local/lib/python3.10/site-packages/urlwatch/filters.py", line 764, in _get_filtered_elements
namespaces=self.namespaces).evaluate(root)
AttributeError: 'CSSSelector' object has no attribute 'evaluate'
I've tried a force reinstall to resolve the problems, to no avail. The versions of urlwatch and lxml which provides the CSSSelector
class are
- urlwatch 2.28
- lxml 5.1.0
urlwatch is installed locally with the --user
flag, which also installs lxml and other dependencies locally, as I don't have write access to the system.
The sysadmins tell me that they tried running urlwatch on an Ubuntu box and received the same errors.
The problem was introduced in lxml 5. You can install 4.9.4 (pip install -U "lxml<5"
) until the maintainers have time to migrate.
Thanks, that resolves the problem.
FWIW, how the problem occurred was the original install relied on the system-installed lxml and the system upgrade upgraded lxml to version 5.0.0. On reinstall of urlwatch with --user
, the latest lxml, version 5.1.0, was installed locally.