Skip to content

爬取失败,报错 AttributeError: 'NoneType' object has no attribute 'xpath' #19

@waynezhao12

Description

@waynezhao12

crawling : http://www.autolabor.com.cn/book/ROSTutorials/di-7-zhang-ji-qi-ren-dao-822a28-fang-771f29/104-ben-zhang-xiao-jie.html
Traceback (most recent call last):
File "/app/gitbook.py", line 303, in
Gitbook2PDF(url).run()
File "/app/gitbook.py", line 192, in run
loop.run_until_complete(self.crawl_main_content(content_urls))
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
return future.result()
File "/app/gitbook.py", line 214, in crawl_main_content
await asyncio.gather(*tasks)
File "/app/gitbook.py", line 235, in gettext
text = ChapterParser(metatext, title, level, ).parser()
File "/app/gitbook.py", line 92, in parser
if tree.xpath('//section[@Class="normal markdown-section"]'):
AttributeError: 'NoneType' object has no attribute 'xpath'

请问如何解决?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions