时发生。
我正在使用的scrapy plash在本地计算机上工作正常,但是当我在Ubuntu Server上使用它时,它会返回此错误。这是为什么?是由低记忆引起的吗?
File "/usr/local/lib64/python2.7/site-packages/twisted/internet/defer.py", line 1299, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/site-packages/scrapy/core/downloader/middleware.py", line 53, in process_response
spider=spider)
File "/usr/local/lib/python2.7/site-packages/scrapy_splash/middleware.py", line 387, in process_response
response = self._change_response_class(request, response)
File "/usr/local/lib/python2.7/site-packages/scrapy_splash/middleware.py", line 402, in _change_response_class
response = response.replace(cls=respcls, request=request)
File "/usr/local/lib/python2.7/site-packages/scrapy/http/response/text.py", line 50, in replace
return Response.replace(self, *args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/scrapy/http/response/__init__.py", line 79, in replace
return cls(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/scrapy_splash/response.py", line 33, in __init__
super(_SplashResponseMixin, self).__init__(url, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'encoding'
更新
它仅在使用localhost作为 SPLASH_URL
TypeError: init ()有一个意外的关键字参数'编码'
看来,您将某个地方启动(实例创建可能)传递给一个额外的参数"编码"。尝试调查。
我通过使用确切的URL来解决它:
SPLASH_URL = 'http://therealip:8050'
任何Localhost解决方案均行不通。我认为这是废品飞溅的错误。
update
事实证明,如果我关闭crawlera,错误也消失了。但是随后它重现了另一个错误。最好不要在配置中使用本地主机。