简体   繁体   中英

Scrapy AttributeError: 'NoneType' object has no attribute 'css'

I'm trying to scrape details from this page using Scrapy: link

This is the command I am using to pull the Title but it is throwing an error:

response.css('#intitule > div.nom_fugitif::text').extract_first()

This is the error:


AttributeError Traceback (most recent call last) in ()

----> 1 response.css('#intitule > div.nom_fugitif::text').extract_first()

AttributeError: 'NoneType' object has no attribute 'css'

It says the div has no CSS but I'm not sure what that means because it does have a CSS class.

NoneType means you're actually getting None in your response. You can check with

if response is not None:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM