Alert: There is a planned Community maintenance outage October 16th from approximately 10 - 11 PM PST. During this time the Alteryx Community will be inaccessible. Thank you for your understanding!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

bs4.Feature Not Found Error Message

charfeldman
5 - Atom

Hi Alteryx Community,

 

Has anyone seen this error message before when running an Analytic App which uses python?

 

The app works on my own desktop but when a friend tried to run it, he got the error message shown below. I am wondering whether he needs to download more packages that I already have downloaded but forgot to include in the Python script. The python script embedded in the Analytic App is as follows:

 

#################################
# List all non-standard packages to be imported by your
# script here (only missing packages will be installed)
from ayx import Package
from ayx import Alteryx
Package.installPackages(['requests'])
Package.installPackages(['bs4'])


#################################
import requests
from urllib import request, response, error, parse
from urllib.request import urlopen
from bs4 import BeautifulSoup
import pandas as pd


#################################
stock = 'UBER'
url_competitors = 'https://money.cnn.com/quote/competitors/competitors.html?symb='+ stock


#################################
# Fetch the html file
response = urlopen(url_competitors)
html_doc = response.read()


#################################
# Parse the html file
soup = BeautifulSoup(html_doc, 'html.parser')


#################################
# Format the parsed html file
strhtm = soup.prettify()


#################################
section = soup.find_all('a', class_='wsod_symbol')


#################################
print(section)


#################################
list_rows = []
str_cells = str(section)
clean_text = BeautifulSoup(str_cells,"lxml").get_text()
list_rows.append(clean_text)


#################################
print(clean_text)


#################################
df = pd.DataFrame(list_rows)


#################################
print(df)


#################################
Alteryx.write(df,1)


################################

 

charfeldman_0-1622656323112.png

 

1 REPLY 1
TheOC
15 - Aurora
15 - Aurora

hey @charfeldman 

I believe you're right - 
It has issue with this line: clean_text = BeautifulSoup(str_cells,"lxml").get_text()

Im not as familiar with BS4 as i'd like to be, but i believe lxml has to be imported too, so try adding:
Package.installPackages(['lxml'])

 

At the start of your code.

Let me know if this helps!
TheOC

 

 

EDIT: from looking at some documentation on lxml, you may also need this too:

Package.installPackages(['html5lib'])


Bulien
Labels