This is Windows 7 with python 2.7
I have a scrapy project in a directory called caps (this is where scrapy.cfg is)
My spider is located in caps\caps\spiders\campSpider.py
I cd into the scrapy project and try to run
scrapy crawl campSpider -o items.json -t json
I get an error that the spider can't be found. The class name is campSpider
...
spider = self.crawler.spiders.create(spname, **opts.spargs)
File "c:\Python27\lib\site-packages\scrapy-0.14.0.2841-py2.7-win32.egg\scrapy\spidermanager.py", l
ine 43, in create
raise KeyError("Spider not found: %s" % spider_name)
KeyError: 'Spider not found: campSpider'
Am I missing some configuration item?
If you are following the tutorial from https://docs.scrapy.org/en/latest/intro/tutorial.html
Then do something like:
The error happens if you try to create the spiders directory yourself under
~/tutorial
Check indentation too, the class for my spider was indented one tab. Somehow that makes the class invalid or something.
I had the same issue. When i was using "scrapy list" in cmd the command listed the spider name i was getting the error for, in the list, but while i tried to run it with scrapy crawl SpiderName.py, i used to get Scrapy spider not found error. I have used this spider before and everything was fine with it. So i used the secret weapon, i restarted my system and the issue was resolved :D
Have you set up the SPIDER_MODULES setting?
Name attribute in CrawlSpider class defines the spider name and this name is used in command line for calling the spider to work.
In my case, i set 'LOG_STDOUT=True', and scrapyd can not return the results to json response when you are looking for your spiders with '/listspiders.json'. And instead of that, the results are being printed to the log files you set at scrapyd's default_scrapyd.conf file. So, I changed the settings as this, and it worked well.