irpas技术客

python response.xpath无效_python - Scrapy error " AttributeError: 'HtmlR

大大的周 7068

-1

When I try the scrapy shell, I have some problems can not solve.

In [1]: response.xpath('//title') --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) in () ----> 1 response.xpath('//title') AttributeError: 'HtmlResponse' object has no attribute 'xpath'

Anyone can help me solve this problem?

python

scrapy

attributeerror

|

this question

edited Apr 10 '15 at 14:56

alecxe 269k 45 408 612 asked Apr 10 '15 at 1:49

kinson li 17 2

|

2 Answers

2

you should upgrade scrapy

2.Uncompress Filest the error cannot import name xmlrpc_client After looking into a stachoverflow question here i have fixed it using sudo pip uninstall scrapysudo pip install scrapy==0.24.2 but now it shows me exceptions.AttributeError: 'HtmlResponse' ob

3.and then: F:\Scrapy-0.24.6>python setup.py install

|

this answer answered Nov 26 '15 at 12:48

jiangzuomei 21 1

|

After upgrade the Scrapy, I solve the problem

|

this answer answered Apr 10 '15 at 2:00

kinson li 17 2

|

per following example. Here is my spider: from scrapy.spider import BaseSpiderclass XxxSpider(BaseSpider): name = "xxx" allow_domains = ["xxx.xxx.xxx"] start_urls = ["http://xxx.xxx.com/jobs/"] def parse(self, response)


1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,会注明原创字样,如未注明都非原创,如有侵权请联系删除!;3.作者投稿可能会经我们编辑修改或补充;4.本站不提供任何储存功能只提供收集或者投稿人的网盘链接。

标签: #Python #Scrapy #error #quot #attributeerror #039HtmlR