python - scrapy how to import the settings to override it -
this code
class test(spider): self.settings.overrides['jobdir']= "seen"
i got:
file "c:\python27\lib\site-packages\scrapy\spider.py", line 46, in settings return self.crawler.settings file "c:\python27\lib\site-packages\scrapy\spider.py", line 41, in crawler assert hasattr(self, '_crawler'), "spider not bounded crawler" assertionerror: spider not bounded crawler
i extending spider
, not using crawler
because don't have links nor rules follow
i guessing problem because didn't import settings , need please
in order change settings in spider can:
class testspider(spider): def set_crawler(self, crawler): super(testspider, self).set_crawler(crawler) crawler.settings.set('jobdir','seen') # rest of spider code
Comments
Post a Comment