gpt4 book ai didi

python - 抓取错误 : Spider not Found

转载 作者:太空宇宙 更新时间:2023-11-04 06:52:29 26 4
gpt4 key购买 nike

我已经看过类似的问题并尝试了给出的答案但无济于事。有人可以帮我纠正这个吗?

谢谢

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'

最佳答案

你应该使用 spider name ,而不是脚本名称。

例如,如果您有以下蜘蛛:

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

在这种情况下,您可以将其运行为:

scrapy crawl myspider

关于python - 抓取错误 : Spider not Found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24738672/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com