我昨天安装了一个stripe包,现在我的应用程序不能运行。我想知道问题出在哪里。是与PyShell
或HTMLParser
有关还是其他原因。我同时使用GAE标签发布,希望从日志跟踪中可以得到有关问题的线索:
MLStripper instance has no attribute 'rawdata'
Traceback (most recent call last):
File "/base/python_runtime/python_lib/versions/1/google/appengine/ext/webapp/_webapp25.py", line 703, in __call__
handler.post(*groups)
File "/base/data/home/apps/ting-1/1.354723388329082800/ting.py", line 2070, in post
pitch_no_tags = strip_tags(pitch_original)
File "/base/data/home/apps/ting-1/1.354723388329082800/ting.py", line 128, in strip_tags
s.feed(html)
File "/base/python_runtime/python_dist/lib/python2.5/HTMLParser.py", line 107, in feed
self.rawdata = self.rawdata + data
AttributeError: MLStripper instance has no attribute 'rawdata'
这是 MLStripper:
from HTMLParser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
set()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
昨天之前,MLStripper一直工作得很好。
以下是我的其他问题:
https://stackoverflow.com/questions/8152141/how-to-fix-this-attributeerror-with-htmlparser-py
https://stackoverflow.com/questions/8153300/how-to-fix-a-corrupted-pyshell-py
__init__
方法,这是特别好的建议。 - noɥʇʎԀʎzɐɹƆ