Skip to content

Instantly share code, notes, and snippets.

@gtoast
Created May 13, 2020 23:36
Show Gist options
  • Save gtoast/a4bb8eb00bc80b304fe8ff915b350873 to your computer and use it in GitHub Desktop.
Save gtoast/a4bb8eb00bc80b304fe8ff915b350873 to your computer and use it in GitHub Desktop.
A Lisp Programmer Living in Python-Land
(import [bs4 [BeautifulSoup]])
(setv raw-data
"<html><body><a href=\"http://markwatson.com\">Mark</a></body></html>")
(setv soup (BeautifulSoup raw-data "lxml"))
(setv a (.find-all soup "a"))
(print "a tags:" a)
$ hy ch1ex1.hy
Traceback (most recent call last):
File "/Users/cdimara/Development/living_in_python_land/living_in_python_land_env/bin/hy", line 8, in <module>
sys.exit(hy_main())
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/cdimara/Development/living_in_python_land/ch1ex1.hy", line 5, in <module>
(setv soup (BeautifulSoup raw-data "lxml"))
File "/Users/cdimara/Development/living_in_python_land/living_in_python_land_env/lib/python3.7/site-packages/bs4/__init__.py", line 228, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment