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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

python - Django-cities exits with "killed" -

python - How to get a widget position inside it's layout in Kivy? -