gpt4 book ai didi

python - 在 Windows 上运行 Portia (scrapy)

转载 作者:太空宇宙 更新时间:2023-11-04 01:16:50 26 4
gpt4 key购买 nike

我已经根据本指南在 Windows 8.1 上成功安装了 Portia http://doc.scrapy.org/en/latest/intro/install.html#windows (使用 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

知道如何解决这个问题吗?

最佳答案

不幸的是,您被 Python 2.7.7 版本引入的回归所困扰:

http://bugs.python.org/issue21652

降级到 Python 2.7.6 或更早版本将暂时解决此问题。

关于python - 在 Windows 上运行 Portia (scrapy),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24021206/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com