在heroku应用程序上使用Beautiful Soup

我正在尝试使用以下库来部署我用Python制造的机器人: 请求,beautifulsoup4,不和谐。

我相信它将使用git hub和Heroku进行部署。机器人成功部署;但是,当我检查日志时,机器人已崩溃。这是错误消息:

2020-05-17T23:17:42.624634+00:00 app[api]: Deploy 83c32a30 by user ****************************
2020-05-17T23:17:42.624634+00:00 app[api]: Release v12 created by user ****************************
2
2020-05-17T23:17:43.134443+00:00 heroku[worker.1]: State changed from crashed to starting
2020-05-17T23:17:48.338694+00:00 heroku[worker.1]: State changed from starting to up
2020-05-17T23:17:51.764352+00:00 heroku[worker.1]: State changed from up to crashed
2020-05-17T23:17:51.660991+00:00 app[worker.1]: Traceback (most recent call last):
2020-05-17T23:17:51.661016+00:00 app[worker.1]: File "BocoBot_Version1.py", line 126, in <module>
2020-05-17T23:17:51.661182+00:00 app[worker.1]: soup = BeautifulSoup(source, 'lxml')
2020-05-17T23:17:51.661184+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.6/site-packages/bs4/__init__.py", line 245, in __init__
2020-05-17T23:17:51.661401+00:00 app[worker.1]: % ",".join(features))
**2020-05-17T23:17:51.661423+00:00 app[worker.1]: bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?**
2020-05-17T23:17:57.000000+00:00 app[api]: Build succeeded

我相信这是有问题的问题:

bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?

但是我不知道该怎么做才能解决它。我的猜测是,这与我的requirements.txt文件有关,在该文件中我告诉它要添加哪些软件包。但是,无论我对BeautifulSoup4进行了什么更改,它仍然无法正常工作。

这是requirements.txt文件信息:

git+https://github.com/Rapptz/discord.py
PyNaCl==1.3.0
pandas
beautifulsoup4
requests
discord
dnspython==1.16.0
async-timeout==3.0.1

任何建议将不胜感激,我将很乐意添加更多信息。

评论
淡_然
淡_然

Try adding lxml to your requirements.txt.

点赞
评论