Python Forum
Error about parser library and tree builder
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error about parser library and tree builder
#1
I am trying to run the code shown below. It fails at the line indicated as shown in this error;

FeatureNotFound                           Traceback (most recent call last)
<ipython-input-9-42bc73e2ba3f> in <module>
----> 1 soup = BeautifulSoup(html, 'lxml')

~\miniconda3\lib\site-packages\bs4\__init__.py in __init__(self, markup, features, builder, parse_only, from_encoding, exclude_encodings, element_classes, **kwargs)
    241             builder_class = builder_registry.lookup(*features)
    242             if builder_class is None:
--> 243                 raise FeatureNotFound(
    244                     "Couldn't find a tree builder with the features you "
    245                     "requested: %s. Do you need to install a parser library?"

FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library? 
I am using beautiful soup 4.9.3 and bs4 0.0.1

I am using python 3.8.10 on Windows 10 64 bit.

The code for the program is as follows:

from bs4 import BeautifulSoup
import requests
import re
import time
import random
import sys
import numpy as np
import pandas as pd
from selenium import webdriver
import chromedriver_binary

link = 'https://finance.yahoo.com/quote/AAPL/financials?p=AAPL'

url = link

user_agent = {'User-agent': 'Mozilla/5.0'}
response  = requests.get(url, headers = user_agent)

# !pip install chromedriver-binary==79.0.3945.36

# !pip install selenium

driver = webdriver.Chrome()

driver.get(link)

html = driver.execute_script("return document.body.innerHTML;")

soup = BeautifulSoup(html, 'lxml')


There are alternative inputs for

soup = BeautifulSoup(html,'lxml')

I have tried a few and nothing works.

Please inform a to how to remove error.

Respectfuly,

LZ
Reply


Messages In This Thread
Error about parser library and tree builder - by Led_Zeppelin - Jun-07-2021, 07:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error in blend_modes library talgreen 6 999 Jul-01-2023, 05:32 PM
Last Post: talgreen
  python requests library .JSON() error mHosseinDS86 6 3,452 Dec-19-2022, 08:28 PM
Last Post: deanhystad
  Install any library via pip get an error cannot import name 'SCHEME_KEYS' from 'pip. Anldra12 2 10,674 Jan-04-2022, 01:05 PM
Last Post: Anldra12
  How to get GUI builder Kivy to work with Pycharm? river251 3 2,593 Jan-31-2021, 01:01 PM
Last Post: jefsummers
  error while installing any library using pip in windows AkashKansal 1 4,411 Sep-24-2020, 07:51 AM
Last Post: buran
  libhdf5 library error (opencv-contrib) 1979gian 0 1,957 May-11-2020, 06:10 PM
Last Post: 1979gian
  Syntax Error with Argument Parser aditya_man 1 3,929 Sep-30-2019, 01:21 PM
Last Post: ichabod801
  Error message when importing jsonlines library vakil67 5 7,364 May-16-2018, 08:51 PM
Last Post: vakil67
  Fix Memory Error while installing a library for Qgis alexastorga 0 2,590 Apr-13-2018, 04:54 PM
Last Post: alexastorga
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,814 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020