Skip to content

cannot import name 'Extractor' from 'selectorlib' #85

@blessdog

Description

@blessdog
  • selectorlib version: 0.16.0
  • Python version: 3.10.5
  • Operating System: macOS 13.0.1 (Apple M1 chip)

Description

import selectorlib
from selectorlib import Extractor
Traceback (most recent call last):
File "", line 1, in
ImportError: cannot import name 'Extractor' from 'selectorlib' (unknown location)

I am trying to import Extractor from selectortlib
I get an error telling me that the "Extractor" is unknown import symbol

What I Did

I have uninstalled and reinstalled SelectorLib by pip install and from source from Github. Nothing seems to correct the issue. I believe that this might be related to my OS or this machine having an M1 chip.

####from my python script

`from selectorlib import Extractor
import requests

r = requests.get("https://www.timeanddate.com/weather/usa/portland-or")
c = r.content
c = r.text

extractor = Extractor.from_yaml_file('temperature.yaml')`

##### I get this error. 

`Traceback (most recent call last):
  File "/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-Calorie-Weba
pp/scraper.py", line 1, in <module>
    from selectorlib import Extractor
  File "/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-Calorie-Weba
pp/env/lib/python3.10/site-packages/selectorlib/__init__.py", line 9, in <module>
    from .selectorlib import Extractor  # noqa:F401
  File "/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-Calorie-Weba
pp/env/lib/python3.10/site-packages/selectorlib/selectorlib.py", line 2, in <module>
    import parsel
  File "/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-Calorie-Weba
pp/env/lib/python3.10/site-packages/parsel/__init__.py", line 10, in <module>
    from parsel.selector import Selector, SelectorList  # NOQA
  File "/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-Calorie-Weba
pp/env/lib/python3.10/site-packages/parsel/selector.py", line 8, in <module>
    from lxml import etree, html
ImportError: dlopen(/Users/SSDrive/Documents/intermediate_python/files/App-6-Project-
Calorie-Webapp/env/lib/python3.10/site-packages/lxml/etree.cpython-310-darwin.so, 0x0
002): symbol not found in flat namespace '__PyGen_Send'

[Process exited 1]`
`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions