我在Windows 7(64位)上使用Python 2.5。在龍捲風web服務器上運行hello world的問題(Python 2.5,Win 7)
我安裝了pycurl-7.15.5.1(win win二進制文件)和龍捲風(使用pip)。
當我運行下面的hello world代碼:
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello World!")
if __name__=='__main__':
app = tornado.web.Application([(r"/",MainHandler),])
application.listen(8888)
tornado.ioloop.IOLoop.instance().start()
我得到以下錯誤: -
Traceback (most recent call last):
File "hello_tornado.py", line 11, in <module>
application.listen(8888)
File "c:\Python25\Lib\site-packages\tornado\web.py", line 1193, in listen
server.listen(port, address)
File "c:\Python25\Lib\site-packages\tornado\netutil.py", line 100, in listen
sockets = bind_sockets(port, address=address)
File "c:\Python25\Lib\site-packages\tornado\netutil.py", line 263, in bind_sockets
sock.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, 1)
AttributeError: 'module' object has no attribute 'IPV6_V6ONLY'
它不應該是'app.listen(8888)',而不是'應用。聽(8888)'?應用程序沒有在任何地方實例化。 – Shule