Scrapy:TypeError:参数类型为';非类型';这是不可容忍的

Scrapy:TypeError:参数类型为';非类型';这是不可容忍的,scrapy,nonetype,Scrapy,Nonetype,Whit scrapy,我在启动spider时收到此NoneType错误: 如果tab_-arrivee_th:TypeError:类型为“NoneType”的参数中有“Jockey” 这是不可容忍的 代码在控制台测试中使用列表,但在response.css中无法正常工作。 我认为问题来自于的响应,我不明白为什么,因为“scrapy shell”给了我一个列表作为回报,这与我在测试中使用的是一样的 def parse(self, response): tab_arrivee_th =

Whit scrapy,我在启动spider时收到此
NoneType
错误:

如果tab_-arrivee_th:TypeError:类型为“NoneType”的参数中有“Jockey” 这是不可容忍的

代码在控制台测试中使用
列表
,但在
response.css
中无法正常工作。 我认为问题来自于
的响应,我不明白为什么,因为“scrapy shell”给了我一个列表作为回报,这与我在测试中使用的是一样的

def parse(self, response):

    tab_arrivee_th = response.css('.arrivees th::text').extract()

  # list obtained whit the response.css from above in scrapy shell

  # tab_arrivee_th = ['Cl.', 'N°', 'Cheval', 'S/A', 'Œill.', 'Poids', 'Corde', 'Ecart', 'Jockey', 'Entraîneur', 'Tx', 'Récl.', 'Rapp. Ouv.']

    if 'Jockey' in tab_arrivee_th:
        col_jockey = tab_arrivee_th.index('Jockey') + 1
    elif 'Driver' in tab_arrivee_th:
        col_jockey = tab_arrivee_th.index('Driver') + 1
    else:
        col_jockey = 0


    jockey = partant.css('td:nth-child(' + str(col_jockey) + ') > a::text').extract()

如果tab_-arrivee_th:TypeError:类型为“NoneType”的参数中有“Jockey” 这是不可容忍的


thx要获得帮助,请再次检查响应。

已解决:'response.css('.arries th::text').extract()指向js中的列表结构。

因此,我使用了scrapy splash来延迟0.5秒。而且效果很好

我刚刚检查过的可能重复项,回答是一个列表:[“Cl.”、“N°”、“Cheval”、“S/a”、“Œill.”、“Poids”、“Corde”、“Ecart”、“Jockey”、“Entraîneur”、“Tx”、“RéCl.”、“Rapp.Ouv.”