Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x “刮擦过的例外情况”;提高“退换货(val)扭曲.互联网.延迟.”退换货:“退换货”;_Python 3.x_Scrapy_Twisted_Twisted.internet_Scrapinghub - Fatal编程技术网

Python 3.x “刮擦过的例外情况”;提高“退换货(val)扭曲.互联网.延迟.”退换货:“退换货”;

Python 3.x “刮擦过的例外情况”;提高“退换货(val)扭曲.互联网.延迟.”退换货:“退换货”;,python-3.x,scrapy,twisted,twisted.internet,scrapinghub,Python 3.x,Scrapy,Twisted,Twisted.internet,Scrapinghub,当我在本地(windows 10)运行代码时,一切正常。 已检查此处的其他答案和其他资源,但未能找到任何解决方案。 部署到ScrapingHub后,我收到以下错误消息: [scrapy.core.scraper] Spider error processing <POST http://oris.co.palm-beach.fl.us/or_web1/new_sch.asp> (referer: http://oris.co.palm-beach.fl.us/or_web1/) Le

当我在本地(windows 10)运行代码时,一切正常。 已检查此处的其他答案和其他资源,但未能找到任何解决方案。 部署到ScrapingHub后,我收到以下错误消息:

[scrapy.core.scraper] Spider error processing <POST http://oris.co.palm-beach.fl.us/or_web1/new_sch.asp> (referer: http://oris.co.palm-beach.fl.us/or_web1/) Less
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1299, in _inlineCallbacks
    result = g.send(result)
  File "/usr/local/lib/python3.6/site-packages/scrapy/core/downloader/middleware.py", line 43, in process_request
    defer.returnValue((yield download_func(request=request,spider=spider)))
  File "/usr/local/lib/python3.6/site-packages/twisted/internet/defer.py", line 1276, in returnValue
    raise _DefGen_Return(val)
twisted.internet.defer._DefGen_Return: <200 http://oris.co.palm-beach.fl.us/or_web1/new_sch.asp>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/scrapy/core/spidermw.py", line 42, in process_spider_input
    result = method(response=response, spider=spider)
  File "/usr/local/lib/python3.6/site-packages/scrapy_pagestorage.py", line 68, in process_spider_input
    self.save_response(response, spider)
  File "/usr/local/lib/python3.6/site-packages/scrapy_pagestorage.py", line 102, in save_response
    self._writer.write(payload)
  File "/usr/local/lib/python3.6/site-packages/scrapinghub/hubstorage/batchuploader.py", line 224, in write
    data = jsonencode(item)
  File "/usr/local/lib/python3.6/site-packages/scrapinghub/hubstorage/serialization.py", line 38, in jsonencode
    return dumps(o, default=jsondefault)
  File "/usr/local/lib/python3.6/json/__init__.py", line 238, in dumps
    **kw).encode(obj)
  File "/usr/local/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/local/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
TypeError: keys must be a string

嗯。问题在于-
Messagepack不可用
(这在调试日志中,但不在错误中),并且为此项目启用了
页面存储

我已经禁用了页面存储,现在可以正常工作了


我希望错误消息在Scrapy和SH中更具可读性。

好。问题在于-
Messagepack不可用(这是在调试日志中,而不是在错误中),并且为此项目启用了
页面存储

我已经禁用了页面存储,现在可以正常工作了

我希望错误消息在Scrapy和SH中更具可读性。

如果您发布一个完整的示例,则有人可能更容易诊断问题。如果您发布一个完整的示例,则有人可能更容易诊断问题。请参阅
start_urls = ['http://oris.co.palm-beach.fl.us/or_web1/']
def parse(self, response):
        # inspect_response(response, self)

        url = 'http://oris.co.palm-beach.fl.us/or_web1/new_sch.asp'
        headers = {
                        'upgrade-insecure-requests': "1",
                        'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36",
                        'origin': "http://oris.co.palm-beach.fl.us",
                        'content-type': "application/x-www-form-urlencoded",
                        'dnt': "1",
                        'accept': "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3",
                        'cache-control': "no-cache",
                                                }
        # Date range should be visin 90 days
        data = {'FromDate': self.FromDate,
                     'PageSize': '500',
                     'RecSetSize': '500',
                     'ToDate': self.ToDate,
                     'consideration': '',
                     'search_by': 'DocType',
                     'search_entry': 'LP'}                                            
        body = urlencode(data)                                         
        yield scrapy.Request(url, method="POST", headers = headers, body = body,  callback = self.parsed)

def parsed(self, response):
        # inspect_response(response, self)
        # Getting all View urls.
        urls=response.xpath("//a[@class = 'list_2']/@href").extract()
        for url in urls:
            url = url.replace('\r', '').replace('\t','').replace('\n','')
            url = url.replace('\r', '').replace('\t','').replace('\n','')
            url = response.urljoin(url)
            url = url.replace('details.asp','details_des.asp') + '&linked=&party_seq='
            yield scrapy.Request(url, callback = self.details)