简体   繁体   中英

Scrapy error: Spider not Found

I have already seen a similar question and tried the answer given but to no avail. Can someone please help me rectify this?

Thanks

hepz@ubuntu:~/Documents/project/project$ scrapy crawl NewsSpider.py
Traceback (most recent call last):
File "/usr/local/bin/scrapy", line 4, in <module> 
execute()
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 143, in execute
_run_print_help(parser, _run_command, cmd, args, opts)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 89, in _run_print_help
func(*a, **kw)
File "/usr/local/lib/python2.7/dist-packages/scrapy/cmdline.py", line 150, in _run_command
cmd.run(args, opts)
File "/usr/local/lib/python2.7/dist-packages/scrapy/commands/crawl.py", line 58, in run
spider = crawler.spiders.create(spname, **opts.spargs)
File "/usr/local/lib/python2.7/dist-packages/scrapy/spidermanager.py", line 44, in create
raise KeyError("Spider not found: %s" % spider_name)
KeyError: 'Spider not found: NewsSpider.py'

You should use the spider name , not the script name.

For example, if you have the following spider:

class MySpider(CrawlSpider):
    name = "myspider"
    ...

In this case, you would run it as:

scrapy crawl myspider

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM