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