Skip to content

UserWarning: Selector got both text and root, root is being ignored. WARNING #5903

Closed
@gelodefaultbrain

Description

@gelodefaultbrain

Description

UserWarning: Selector got both text and root, root is being ignored. Only happens on Ubuntu

Steps to Reproduce

  1. Open a simple python shell
  2. Paste code below
  3. Run it
from scrapy.selector import Selector
link = "<a class='fsm fwn fcdg' target='_blank' href='/ta/id/340639-par-olaines-novada-domes-2009-gada-30-septembra-sedes-lemuma-apstiprinato-saistoso-noteikumu-nr-76-par-detalplanojuma-apstiprinasanu'>Par Olaines novada domes 2009. gada 30. septembra sdes lmum apstiprinto saistoo noteikumu Nr. 76 'Par detlplnojuma apstiprinanu nekustamajam paumam 'Vrpas' (kad. Nr. 8080 008 0095)', pielikuma Nr. 66 atcelanu</a>"
selector = Selector(text=link, type='html')

Warning output:

/home/iamuser/.local/share/virtualenvs/myenv-YA2UsV5L/lib/python3.11/site-packages/scrapy/selector/unified.py:83: UserWarning: Selector got both text and root, root is being ignored.
  super().__init__(text=text, type=st, root=root, **kwargs)

Expected behavior: No warnings? It's quite strange because it doesn't appear on MacOS and Windows

Actual behavior: Shows warning message above

Reproduces how often: 100% on Ubuntu

Versions

Please paste here the output of executing scrapy version --verbose in the command line.

Scrapy       : 2.8.0
lxml         : 4.9.2.0
libxml2      : 2.9.14
cssselect    : 1.2.0
parsel       : 1.8.1
w3lib        : 2.1.1
Twisted      : 22.10.0
Python       : 3.11.2 (main, Feb  7 2023, 13:52:42) [GCC 11.3.0]
pyOpenSSL    : 23.1.1 (OpenSSL 3.0.8 7 Feb 2023)
cryptography : 39.0.1
Platform     : Linux-5.15.0-69-generic-x86_64-with-glibc2.35

Additional context

Why does this warning appear on ubuntu? I tried running it on MacOS and Windows and it doesn't appear. Is this something of a concern? I believe this should be supressed. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions