开始使用Tornado
在通过apt安装了必要的软件包(比如python 2.5、simplejson等)之后,当我尝试运行演示程序时出现了错误。
: Request instance has no attribute 'responseHeaders'
/usr/lib/python2.5/site-packages/tornado/web.py, line 404 in flush
402 for k,v in self._generate_headers():
403 if isinstance(v, list):
404 self.request.responseHeaders.setRawHeaders(k, v)
405 else:
Self
request
twisted.web.server.Request instance @ 0x85da24c
Locals
self
k 'Set-Cookie'
v
List instance @ 0x85da46c
这里有证明显示必要的软件包已经安装好了。
/web/tmp/tornado/demos/helloworld# dpkg -l | grep python2.5
ii python2.5 2.5.2-2ubuntu6 An interactive high-level object-oriented la
ii python2.5-dev 2.5.2-2ubuntu6 Header files and a static library for Python
ii python2.5-minimal 2.5.2-2ubuntu6 A minimal subset of the Python language
# dpkg -l | grep simplejson
ii python-simplejson 1.7.3-1
# dpkg -l | grep pycurl
ii python-pycurl 7.16.4-1
看起来好像没有太多人在尝试这个来自friendfeed的Tornado东西。有没有人能给我一些建议或者提示,帮助我顺利开始使用它呢?
1 个回答
2
我原以为tornado这个框架不需要依赖twisted。你试过“官方”的版本吗?第404行的内容完全不一样。
http://github.com/facebook/tornado/blob/master/tornado/web.py
def flush(self, include_footers=False):
"""Flushes the current output buffer to the nextwork."""
if self.application._wsgi:
raise Exception("WSGI applications do not support flush()") #line 404
if not self._headers_written:
self._headers_written = True
headers = self._generate_headers()
else:
headers = ""
除此之外,我建议你试着安装twisted,看看会发生什么。