首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Windows上运行Portia (scrapy)

在Windows上运行Portia (scrapy)
EN

Stack Overflow用户
提问于 2014-06-03 17:17:22
回答 1查看 1.8K关注 0票数 2

根据本指南http://doc.scrapy.org/en/latest/intro/install.html#windows (使用pip而不是easy_install),我已经成功地在Windows8.1上安装了Portia。

当通过twistd.py -n slyd开始slyd时,一切似乎都很好,直到我打开http://localhost:9001/static/main.html网站。控制台窗口中显示以下错误:

代码语言:javascript
复制
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

我认为重要的信息是:

代码语言:javascript
复制
exceptions.TypeError: Can only pass-through bytes on Python 2

exceptions.RuntimeError: Producer was not unregistered for /static/main.html

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

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-06-03 18:10:31

不幸的是,Python2.7.7发行版引入了回归,您被咬伤了:

http://bugs.python.org/issue21652

降级到Python2.7.6或更早版本将解决这个问题。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24021206

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档