Scrapy Splash on Ubuntu server: got an unexpected keyword argument 'encoding'
Asked Answered
M

2

0

The Scrapy Splash I am using is working just fine on my local machine, but it returns this error when I use it on my Ubuntu server. Why is that? Is it caused by low memory?

  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'

UPDATE

It only happens when using localhost as SPLASH_URL

Methuselah answered 12/3, 2017 at 6:38 Comment(0)
M
0

I solve it by using the exact URL instead:

SPLASH_URL = 'http://therealip:8050'

Any localhost solution doesn't work. I think it's a bug in Scrapy Splash.

UPDATE

It turns out, the error is also gone if I turn off Crawlera. But then it reproduces another error. It's best to not use localhost in the configuration.

Methuselah answered 12/3, 2017 at 6:56 Comment(0)
L
0

TypeError: init() got an unexpected keyword argument 'encoding'

It seems that you passing somewhere to class init (instance creating probably) an extra parameter 'encoding'. Try to investigate that.

Laylalayman answered 26/3, 2017 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.