2012-04-24 111 views
3

我已經設置了我的PATH變量,我想我正在配置一切正確。但是,當我在我的startproject命令文件夾中運行「scrapy爬行DMOZ」,我得到這些錯誤消息:scrapy新手:教程。運行scrapy爬行時出錯dmoz

c:\matt\testing\dmoz>scrapy crawl dmoz 
2012-04-24 18:12:56-0400 [scrapy] INFO: Scrapy 0.14.0.2841 started (bot: dmoz) 
2012-04-24 18:12:56-0400 [scrapy] DEBUG: Enabled extensions: LogStats, TelnetConsole,   
CloseSpider, WebService, CoreStats, SpiderState 
2012-04-24 18:12:56-0400 [scrapy] DEBUG: Enabled downloader middlewares:  
HttpAuthMiddleware, DownloadTimeoutMiddleware, UserAgentMiddleware, RetryMiddleware, 
faultHeadersMiddleware, RedirectMiddleware, CookiesMiddleware, 
HttpCompressionMiddleware, ChunkedTransferMiddleware, DownloaderStats 
2012-04-24 18:12:56-0400 [scrapy] DEBUG: Enabled spider middlewares: 
HttpErrorMiddleware, OffsiteMiddleware, RefererMiddleware, UrlLengthMiddleware, DepthMiddware 
2012-04-24 18:12:56-0400 [scrapy] DEBUG: Enabled item pipelines: 
Traceback (most recent call last): 
File "c:\Python27\Scripts\scrapy", line 4, in <module> 
execute() 
File "c:\Python27\lib\site-packages\scrapy-0.14.0.2841-py2.7- 
win32.egg\scrapy\cmdline.py", line 132, in execute 
_run_print_help(parser, _run_command, cmd, args, opts) 
File "c:\Python27\lib\site-packages\scrapy-0.14.0.2841-py2.7- 
win32.egg\scrapy\cmdline.py", line 97, in _run_print_help 
func(*a, **kw) 
File "c:\Python27\lib\site-packages\scrapy-0.14.0.2841-py2.7- 
win32.egg\scrapy\cmdline.py", line 139, in _run_command 
cmd.run(args, opts) 
File "c:\Python27\lib\site-packages\scrapy-0.14.0.2841-py2.7- 
win32.egg\scrapy\commands\crawl.py", line 43, in run 
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", line 43, in create 
raise KeyError("Spider not found: %s" % spider_name) 
KeyError: 'Spider not found: dmoz' 

有誰知道什麼可能是怎麼回事?

+2

顯示你的目錄結構,你的蜘蛛類的源碼和設置模塊 – warvariuc 2012-04-25 07:27:08

+0

請選擇一個最好的答案! – realtebo 2013-06-08 10:17:32

+0

此外,本教程未能提及您還需要此庫: https://github.com/scrapy/queuelib – 2013-11-19 02:25:56

回答

0

嘗試在命令行

C:\Users\Akhtar Wahab> python # any any directory path 

,如果它工作

嘗試

scrapy version 

如果還工作

然後確保你

做出scrapy項目
scrapy startproject name 

如果上述一切工作正適合你

然後確保你是在一個目錄下scrapy.cfg存在刮板運行命令。

12

我也有這個問題。

這是因爲scrapy教程會要求您將您創建的蜘蛛放置在/dmoz/spiders/中,但scrapy正在尋找tutorial/tutorial/spiders

dmoz_spider.py保存在tutorial/tutorial/spiders中,爬網應該可以工作。

+0

謝謝!!!!!!爲什麼作者沒有選擇最佳答案? – realtebo 2013-06-08 10:16:59