Python issue: Couldn't find a tree builder with the features you requested

I am running security scan via Qark. I am unable to generate html report and I get this error message:

ERROR - failed to write report
Traceback (most recent call last):
  File "/bitrise/src/build/qark/qark/modules/report.py", line 72, in writeSection
    pre_rendered_html2 = BeautifulSoup(pre_rendered, 'html5lib')
  File "/bitrise/src/build/qark/qark/lib/bs4/__init__.py", line 152, in __init__
    % ",".join(features))
FeatureNotFound: Couldn't find a tree builder with the features you requested: html5lib. Do you need to install a parser library?

I tried installing the BeautifulSoup library via pip but still no success. It runs fine on my machine and our previous CI server.

Can it be a python version issue @accolademobile?

From: https://stackoverflow.com/a/26856894/974381

Assuming you are in OSX, the Apple-bundled version of Python is 2.7.2 which is not lenient for character formatting.

Also:

If doing that sounds like a pain, you can switch over to the LXML parser: …

Seems to be a python / dependency issue.

Another from the same StackOverflow thread:

I preferred built in python html parser, no install no dependencies soup = BeautifulSoup(s, “html.parser”)

From that thread it seems it’s not python version related, and most of the replies mention that

pip install lxml

works / solves the issue.

1 Like

Thanks, lxml seemed to have solved the issue. At the end of the build however it says report.html could not be generated. I think that might not be true. So, is there a way to view/download the folder so that I can verify the contents of report.html? I can only find .apks in the artifacts section. Remote login process is not that easy either.

Sure! Please see: http://devcenter.bitrise.io/tips-and-tricks/attach-any-file-to-build/

I fixed with with below changes

Before changes
soup = BeautifulSoup(r.content, 'html5lib' )
print (soup.prettify())

After change
soup = BeautifulSoup(r.content, features=“html”)
print(soup.prettify())

my code work properly

3 Likes