首页
注册
登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请
登录
推荐学习书目
›
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
V2EX
›
Python
scrapy 自己写的 filter 无法加载
nexus6
·
NexusRJ
·
2015 年 11 月 25 日
· 2940 次点击
这是一个创建于 3734 天前的主题,其中的信息可能已经有所发展或是发生改变。
自己实现了一个过滤器方法 custom_filter , settings 中设置
DUPEFILTER_CLASS = 'crawls.spiders.custom_filter'
运行项目时提示'module' object has no attribute 'from_settings'
请问各位有遇到过嘛,或者知道问题大概出在哪里的
filter
attribute
Scrapy
Object
4 条回复
•
2015-11-25 22:44:36 +08:00
1
tongle
2015 年 11 月 25 日
1
http://stackoverflow.com/questions/25063117/how-do-scrapy-from-settings-and-from-crawler-class-methods-work
这个可能对你有点帮助
2
knightdf
2015 年 11 月 25 日
建议你参考 RFPDupefilter 的源码写,然后这个 filter 会被 Scheduler 自动调用 from_settings 函数初始化,源码里都有
3
knightdf
2015 年 11 月 25 日
然后你的错误应该是没有实现 filter 的 classmethod from_settings ,这个是 scheduler 会自动调用的,必须有的
4
nexus6
OP
2015 年 11 月 25 日
@
tongle
多谢回复,回头到公司再研究研究
@
knightdf
多谢,我会试试的,话说 classmethod 是可以继承的吧,继承自 RFDupefilter 的类应该是有这个方法的呀?
纯粹问问,具体结果试过了再说
关于
·
帮助文档
·
自助推广系统
·
博客
·
API
·
FAQ
·
Solana
·
1999 人在线
最高记录 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 24ms ·
UTC 04:06
·
PVG 12:06
·
LAX 20:06
·
JFK 23:06
♥ Do have faith in what you're doing.
❯