推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
Jelly
V2EX  ›  Python

关于统一处理 Scrapy spider 异常的问题

  •  
  •   Jelly · Nov 4, 2016 · 6553 views
    This topic created in 3484 days ago, the information mentioned may be changed or developed.

    Scrapy 项目中有多个 spider ,某些 spider 在处理 response 的时候会出现异常(如 xpath 解析后得到空的 list ,这时去 list[n]的时候就会抛 Indexerror ),有没有什么办法可以统一管理这些异常? 自己写 SpiderMiddleware , spider 抛出异常的时候 process_spider_exception 方法并没有被触发...... 求建议~

    4 replies    2019-04-11 16:16:23 +08:00
    zhuangzhuang1988
        1
    zhuangzhuang1988  
       Nov 4, 2016
    pycharm 调试下流程就好了.
    knightdf
        2
    knightdf  
       Nov 4, 2016
    scrapy,直接看源码的,很清楚的
    mudy
        4
    mudy  
       Apr 11, 2019
    请问你找到解决办法了吗?谢谢!!!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3124 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:46 · PVG 19:46 · LAX 04:46 · JFK 07:46
    ♥ Do have faith in what you're doing.