I have this line of code in my spider
settings.overrides['JOBDIR']= self.domain+"_"+self.Category+"_"+self.Action
I got this error:
__
settings.overrides['JOBDIR']= self.domain+"_"+self.Category+"_"+self.Action
NameError: global name 'settings' is not defined
I run my spider from a script like this:
def setup_crawler(domain):
spider = GeneralSpider(xmlFile=domain)
settings = get_project_settings()
crawler = Crawler(settings)
crawler.configure()
crawler.crawl(spider)
crawler.start()
get_project_settings()
looks for the environment variableSCRAPY_SETTINGS_MODULE
to be set. Make sure it is set in your environment. The documentation here explains how to set it.