Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CSS Filter "AttributeError: 'CSSSelector' object has no attribute 'evaluate'" #783

Closed
jamesquilty opened this issue Jan 15, 2024 · 2 comments · Fixed by #786
Closed

CSS Filter "AttributeError: 'CSSSelector' object has no attribute 'evaluate'" #783

jamesquilty opened this issue Jan 15, 2024 · 2 comments · Fixed by #786

Comments

@jamesquilty
Copy link

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.

@bermeitinger-b
Copy link

bermeitinger-b commented Jan 16, 2024

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.

@jamesquilty
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants