我已根据本指南http://doc.scrapy.org/en/latest/intro/install.html#windows在Windows 8.1上成功安装了Portia(使用了pip而不是easy_install)。
当通过twistd.py -n slyd
启动slyd时,在我打开网站http://localhost:9001/static/main.html
之前,一切似乎都正常。控制台窗口中显示以下错误:
2014-06-03 19:05:56+0200 [-] Log opened.
2014-06-03 19:05:56+0200 [-] twistd 14.0.0 (C:\Python27\python.exe 2.7.7) starting up.
2014-06-03 19:05:56+0200 [-] reactor class: twisted.internet.selectreactor.SelectReactor.
2014-06-03 19:05:56+0200 [-] Site starting on 9001
2014-06-03 19:05:56+0200 [-] Starting factory <twisted.web.server.Site instance at 0x040E0CB0>
2014-06-03 19:07:08+0200 [HTTPChannel,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\twisted\protocols\basic.py", line 571, in dataReceived
why = self.lineReceived(line)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1656, in lineReceived
self.allContentReceived()
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1731, in allContentReceived
req.requestReceived(command, path, version)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 827, in requestReceived
self.process()
--- <exception caught here> ---
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 189, in process
self.render(resrc)
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 238, in render
body = resrc.render(self)
File "C:\Python27\lib\site-packages\twisted\web\resource.py", line 250, in render
return m(request)
File "C:\Python27\lib\site-packages\twisted\web\static.py", line 631, in render_GET
producer.start()
File "C:\Python27\lib\site-packages\twisted\web\static.py", line 710, in start
self.request.registerProducer(self, False)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 873, in registerProducer
self.transport.registerProducer(producer, streaming)
File "C:\Python27\lib\site-packages\twisted\internet\_newtls.py", line 233, in registerProducer
FileDescriptor.registerProducer(self, producer, streaming)
File "C:\Python27\lib\site-packages\twisted\internet\abstract.py", line 112, in registerProducer
producer.resumeProducing()
File "C:\Python27\lib\site-packages\twisted\web\static.py", line 720, in resumeProducing
self.request.write(data)
File "C:\Python27\lib\site-packages\twisted\web\server.py", line 217, in write
http.Request.write(self, data)
File "C:\Python27\lib\site-packages\twisted\web\http.py", line 1002, in write
value = networkString('%s' % (value,))
File "C:\Python27\lib\site-packages\twisted\python\compat.py", line 364, in networkString
raise TypeError("Can only pass-through bytes on Python 2")
exceptions.TypeError: Can only pass-through bytes on Python 2
2014-06-03 19:07:08+0200 [HTTPChannel,0,127.0.0.1] "127.0.0.1" - - [03/Jun/2014:17:07:07 +0000] "GET /static/main.html H
TTP/1.1" 500 10874 "-" "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0"
2014-06-03 19:07:08+0200 [HTTPChannel,0,127.0.0.1] Unhandled Error
Traceback (most recent call last):
Failure: exceptions.RuntimeError: Producer was not unregistered for /static/main.html
我认为重要的信息是:
exceptions.TypeError: Can only pass-through bytes on Python 2
exceptions.RuntimeError: Producer was not unregistered for /static/main.html
知道如何解决这个问题吗?
答案 0 :(得分:3)