Reputation: 31
I am getting an error when trying to run a example .py from the serpscrap package.
I am on an iPhoneX in Pythonista.
Any help would be greatly appreciated.
Here is the traceback
Traceback (most recent call last):
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/testing/serpscrapetest.py", line 3, in <module>
import serpscrap
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/serpscrap/__init__.py", line 5, in <module>
from serpscrap.serpscrap import SerpScrap
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/serpscrap/serpscrap.py", line 11, in <module>
from scrapcore.core import Core
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/scrapcore/core.py", line 8, in <module>
from scrapcore.cachemanager import CacheManager
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/scrapcore/cachemanager.py", line 11, in <module>
from scrapcore.parsing import Parsing
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/scrapcore/parsing.py", line 6, in <module>
from scrapcore.parser.google_parser import GoogleParser
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/scrapcore/parser/google_parser.py", line 7, in <module>
from scrapcore.parser.parser import Parser
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/scrapcore/parser/parser.py", line 7, in <module>
import lxml.html
File "/private/var/mobile/Containers/Shared/AppGroup/C27C5B11-1804-47B9-AF18-7287A8337C55/Pythonista3/Documents/site-packages-3/lxml/html/__init__.py", line 54, in <module>
from .. import etree
ImportError: cannot import name 'etree'
Upvotes: 3
Views: 2608
Reputation: 36
SerpScrap doesn't work on iOS at the moment, because of the lxml dependency. I will update the docs to clearify this point.
But maybe you take a look on https://github.com/pybee/Python-Apple-support . I'm not familiar with iOS, maybe someone can check if this can help to solve this issue. Otherwise feel free to open an issue on the serpscrap github page.
Upvotes: 2
Reputation: 365707
serpscrap
evidently requires lxml
, even though for some reason it only documents that requirement for Windows, rather than for all platforms.
You can't install packages that need C extension modules, like lxml
, in Pythonista. You seem to have somehow gotten the pure-Python part of lxml
installed,1 but that won't do any good without the C extension modules.
There's an open issue, #245, to add lxml
as a pre-installed package with Pythonista, which would probably fix your problem.
So, your options are:
lxml
building so they can close that bug and add lxml
to the next version.serpscrap
to work without lxml
(if it's just using lxml.etree
, it's possible that it would work with the stdlib ETree implementation).serpscrap
and hope someone else does it.lxml
.1. I'm not sure how that could happen; the install should just fail. But maybe serpscrap
does some weird thing that happens to work on Linux and macOS but not iOS, and that's why they only list lxml
as a dependency on Windows in the first place?
Upvotes: 1