Upon running my python script I am getting following error
File "myfile.py", line 538, in parse_format_views_into_memsource_json
page_soup = BeautifulSoup(page, 'xml')
File "C:Python27libsite-packagess4\__init__.py", line 246, in __init__
% ",".join(features))
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: xml. Do you need to install a parser library?
After reading a few posting about bs4, I changed the xml to lxml like below.
page_soup = BeautifulSoup(page, 'lxml')
Now I am getting the same error for lxml
File "myfile.py", line 538, in parse_format_views_into_memsource_json
page_soup = BeautifulSoup(page, 'lxml')
File "C:Python27libsite-packagess4\__init__.py", line 246, 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?
I am very puzzled about this situation. I checked my pip list and surely I do have lxml. The list below.
backports.functools-lru-cache (1.6.1)
backports.shutil-get-terminal-size (1.0.0)
beautifulsoup4 (4.9.3)
certifi (2018.1.18)
chardet (3.0.4)
colorama (0.3.9)
distribute (0.6.19)
idna (2.6)
Jinja2 (2.10)
Logbook (1.2.1)
lxml (4.6.2)
Mako (1.0.7)
MarkupSafe (1.0)
Myghty (1.2)
mysql-connector (2.2.9)
p4python (2017.2.1615960)
Paste (2.0.3)
PasteDeploy (1.5.2)
PasteScript (2.0.2)
pip (9.0.1)
psutil (5.4.3)
psycopg2 (2.7.4)
pymssql (2.1.3)
pyodbc (4.0.22)
pypm (1.3.4)
pythonselect (1.3)
pywin32 (214)
PyYAML (3.12)
RBTools (1.0.4.dev1)
repoze.lru (0.7)
requests (2.18.4)
Routes (2.4.1)
setuptools (38.4.0)
six (1.11.0)
soupsieve (1.9.6)
SQLAlchemy (1.2.2)
texttable (1.4.0)
tqdm (4.19.5)
urllib3 (1.22)
virtualenv (15.1.0)
wheel (0.30.0)
Am I missing anything here?
==== Update ===
I have checked import on lxml. Although I pip installed lxml, I cannot import lxml or lxml.etree. What makes more confusing is that I can import bs4 without any problem. I pip installed them at the same time and the same manner. I don't know how to proceed from here.
I checked the pip package list again, this time from the script itself using following command.
import pkg_resources
print([p.project_name for p in pkg_resources.working_set])
It clearly shows that there lxml is available the the Python instance I am using. Below is the output
['wsgiref', 'wheel', 'virtualenv', 'urllib3', 'tqdm', 'texttable',
'SQLAlchemy', 'soupsieve', 'six', 'setuptools', 'Routes', 'requests',
'repoze.lru', 'RBTools', 'PyYAML', 'pywin32', 'pythonselect', 'pypm',
'pyodbc', 'pymssql', 'psycopg2', 'psutil', 'pip', 'PasteScript',
'PasteDeploy', 'Paste', 'p4python', 'mysql-connector', 'Myghty',
'MarkupSafe', 'Mako', 'lxml', 'Logbook', 'Jinja2', 'idna',
'distribute', 'colorama', 'chardet', 'certifi', 'beautifulsoup4',
'backports.shutil-get-terminal-size', 'backports.functools-lru-cache']