Skip to content

Remove Parsel #197

Description

@farhaanbukhsh

Detailed explanation: https://github.com/openedx/xblock-image-explorer/blob/2f6772d/requirements/constraints.txt#L13-L28.
Suggested solution: #195 (review).

While using this xblock in Sumac and above, we constantly faced issues.

2025-03-17 13:54:00,477 WARNING 13 [xblock.plugin] [user None] [ip None] plugin.py:144 - Unable to load XBlock 'image-explorer'
--
Traceback (most recent call last):
File "/openedx/venv/lib/python3.11/site-packages/xblock/plugin.py", line 141, in load_classes
yield (class_.name, cls._load_class_entry_point(class_))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.11/site-packages/xblock/plugin.py", line 70, in _load_class_entry_point
class_ = entry_point.load()
^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2496, in load
return self.resolve()
^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2502, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.11/site-packages/image_explorer/__init__.py", line 23, in <module>
from .image_explorer import ImageExplorerBlock
File "/openedx/venv/lib/python3.11/site-packages/image_explorer/image_explorer.py", line 36, in <module>
from parsel import Selector
File "/openedx/venv/lib/python3.11/site-packages/parsel/__init__.py", line 10, in <module>
from parsel.selector import Selector, SelectorList  # NOQA
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/openedx/venv/lib/python3.11/site-packages/parsel/selector.py", line 11, in <module>
from .csstranslator import HTMLTranslator, GenericTranslator
File "/openedx/venv/lib/python3.11/site-packages/parsel/csstranslator.py", line 9, in <module>
from cssselect.xpath import _unicode_safe_getattr, ExpressionError
ImportError: cannot import name '_unicode_safe_getattr' from 'cssselect.xpath' (/openedx/venv/lib/python3.11/site-packages/cssselect/xpath.py)

The issue was occurring first because opened flavoured lxml doesn't open the version method which is used in https://github.com/scrapy/parsel/blob/master/parsel/selector.py#L35 and if we downgrade this cssselect gives the above error because they remove the private method in the latest release.

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueA good task for a newcomer to start withhelp wantedReady to be picked up by anyone in the community

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions