0
我在使用Beautiful Soup的Google应用程序引擎中创建了一个应用程序。我正在使用它的最新版本,http://www.crummy.com/software/BeautifulSoup/bs4/download/4.0/。一切工作正常,直到我上传到GAE。这happend然后的事情是,我得到这个错误:Google Appengine中的BeautifulSoup错误
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 701, in __call__
handler.get(*groups)
File "/base/data/home/apps/s~app/1.358226218191077920/main.py", line 285, in get
self.response.out.write(self.makeQuery("9147094591"))
File "/base/data/home/apps/s~app/1.358226218191077920/main.py", line 191, in makeQuery
from bs4 import BeautifulSoup
File "/base/data/home/apps/s~app/1.358226218191077920/bs4/__init__.py", line 29, in <module>
from .builder import builder_registry
File "/base/data/home/apps/s~app/1.358226218191077920/bs4/builder/__init__.py", line 279, in <module>
from . import _htmlparser
File "/base/data/home/apps/s~app/1.358226218191077920/bs4/builder/_htmlparser.py", line 23, in <module>
from bs4.element import (
File "/base/data/home/apps/s~app/1.358226218191077920/bs4/element.py", line 6, in <module>
from bs4.dammit import EntitySubstitution
File "/base/data/home/apps/s~app/1.358226218191077920/bs4/dammit.py", line 254
smart_quotes_re = b"([\x80-\x9f])"
^
SyntaxError: invalid syntax
当我dammit.py看线254,我觉得这一点:
if (self.smart_quotes_to is not None
and proposed.lower() in self.ENCODINGS_WITH_SMART_QUOTES):
smart_quotes_re = b"([\x80-\x9f])"
smart_quotes_compiled = re.compile(smart_quotes_re)
markup = smart_quotes_compiled.sub(self._sub_ms_char, markup)
我实在看不出有什么不妥。我尝试了其他版本的BS,但他们不工作,因为我使用的汤只选择(“CSS选择器”),似乎只能在最新版本中工作。
但是,正如我前面所说,它在我的电脑上运行良好,但不在云端运行。
它不需要付费应用程序。你只需要在'app.yaml'文件中指定它。它还将要求您明确地打开或关闭线程安全。 – 2012-04-15 14:02:05
但我认为GAE上的2.7仍处于测试阶段。 – 2012-04-15 14:02:48
@JoelCornett:[Nope](http://googleappengine.blogspot.co.uk/2012/02/announcing-general-availability-of.html)! – 2012-04-15 14:04:11