Importing and Using BeautifulSoup for Web App

不羁的心 提交于 2019-12-21 22:35:20

问题


I am currently trying to use BeautifulSoup for a Web App and I have installed the beautifulsoup4 egg in a local dir with easy_install --install-dir=PATH_TO_DIR beautifulsoup4, but when I run my app I'm getting the current error that I don't know what to do about:

Traceback (most recent call last): 
  from bs4 import BeautifulSoup
File "/home/ryanefoley/py_libs/beautifulsoup4-4.3.2-py2.6.egg/bs4/__init__.py", line 186
  if ((isinstance(markup, bytes) and not b' ' in markup)
                                            ^
SyntaxError: invalid syntax

I would greatly appreciate any help!

Note, I am importing the module in my python script with:

egg_path='/home/ryanefoley/py_libs/beautifulsoup4-4.3.2-py2.6.egg'
sys.path.append(egg_path)
from bs4 import BeautifulSoup

来源:https://stackoverflow.com/questions/19718015/importing-and-using-beautifulsoup-for-web-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!