run运行main.py出错

来源:4-4 pycharm中调试scrapy源码

qq_慕神6513837

2021-12-30

run运行main.py
提示以下错误:
E:\scrapy\envs\python38\Scripts\python.exe E:/scrapy/code/ArticleSpider/main.py
2021-12-30 14:44:51 [scrapy.utils.log] INFO: Scrapy 2.5.1 started (bot: ArticleSpider)
2021-12-30 14:44:51 [scrapy.utils.log] INFO: Versions: lxml 4.7.1.0, libxml2 2.9.10, cssselect 1.1.0, parsel 1.6.0, w3lib 1.22.0, Twisted 20.3.0, Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)], pyOpenSSL 21.0.0 (OpenSSL 1.1.1m 14 Dec 2021), cryptography 36.0.1, Platform Windows-10-10.0.19041-SP0
2021-12-30 14:44:51 [scrapy.utils.log] DEBUG: Using reactor: twisted.internet.selectreactor.SelectReactor
2021-12-30 14:44:51 [scrapy.crawler] INFO: Overridden settings:
{‘BOT_NAME’: ‘ArticleSpider’,
‘NEWSPIDER_MODULE’: ‘ArticleSpider.spiders’,
‘ROBOTSTXT_OBEY’: True,
‘SPIDER_MODULES’: [‘ArticleSpider.spiders’]}
2021-12-30 14:44:51 [scrapy.extensions.telnet] INFO: Telnet Password: 64d253ba5f6a3147
2021-12-30 14:44:51 [scrapy.middleware] INFO: Enabled extensions:
[‘scrapy.extensions.corestats.CoreStats’,
‘scrapy.extensions.telnet.TelnetConsole’,
‘scrapy.extensions.logstats.LogStats’]
2021-12-30 14:44:51 [scrapy.middleware] INFO: Enabled downloader middlewares:
[‘scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware’,
‘scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware’,
‘scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware’,
‘scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware’,
‘scrapy.downloadermiddlewares.useragent.UserAgentMiddleware’,
‘scrapy.downloadermiddlewares.retry.RetryMiddleware’,
‘scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware’,
‘scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware’,
‘scrapy.downloadermiddlewares.redirect.RedirectMiddleware’,
‘scrapy.downloadermiddlewares.cookies.CookiesMiddleware’,
‘scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware’,
‘scrapy.downloadermiddlewares.stats.DownloaderStats’]
2021-12-30 14:44:51 [scrapy.middleware] INFO: Enabled spider middlewares:
[‘scrapy.spidermiddlewares.httperror.HttpErrorMiddleware’,
‘scrapy.spidermiddlewares.offsite.OffsiteMiddleware’,
‘scrapy.spidermiddlewares.referer.RefererMiddleware’,
‘scrapy.spidermiddlewares.urllength.UrlLengthMiddleware’,
‘scrapy.spidermiddlewares.depth.DepthMiddleware’]
2021-12-30 14:44:51 [scrapy.middleware] INFO: Enabled item pipelines:
[]
2021-12-30 14:44:51 [scrapy.core.engine] INFO: Spider opened
2021-12-30 14:44:51 [scrapy.extensions.logstats] INFO: Crawled 0 pages (at 0 pages/min), scraped 0 items (at 0 items/min)
2021-12-30 14:44:51 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023
2021-12-30 14:44:52 [scrapy.downloadermiddlewares.redirect] DEBUG: Redirecting (302) to <GET https://news.cnblogs.com/robots.txt> from <GET http://news.cnblogs.com/robots.txt>
2021-12-30 14:44:52 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://news.cnblogs.com/robots.txt> (failed 1 times): 500 Internal Server Error
2021-12-30 14:44:52 [scrapy.downloadermiddlewares.retry] DEBUG: Retrying <GET https://news.cnblogs.com/robots.txt> (failed 2 times): 500 Internal Server Error
2021-12-30 14:44:52 [scrapy.downloadermiddlewares.retry] ERROR: Gave up retrying <GET https://news.cnblogs.com/robots.txt> (failed 3 times): 500 Internal Server Error
2021-12-30 14:44:52 [scrapy.core.engine] DEBUG: Crawled (500) <GET https://news.cnblogs.com/robots.txt> (referer: None)
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 9 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 10 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 11 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 12 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 13 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 14 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 19 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 23 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 32 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 33 without any user agent to enforce it on.
2021-12-30 14:44:52 [protego] DEBUG: Rule at line 35 without any user agent to enforce it on.
2021-12-30 14:44:52 [scrapy.downloadermiddlewares.redirect] DEBUG: Redirecting (302) to <GET https://news.cnblogs.com/> from <GET http://news.cnblogs.com/>
2021-12-30 14:44:52 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://news.cnblogs.com/> (referer: None)
2021-12-30 14:44:52 [scrapy.core.engine] INFO: Closing spider (finished)
2021-12-30 14:44:52 [scrapy.statscollectors] INFO: Dumping Scrapy stats:
{‘downloader/request_bytes’: 1508,
‘downloader/request_count’: 6,
‘downloader/request_method_count/GET’: 6,
‘downloader/response_bytes’: 20559,
‘downloader/response_count’: 6,
‘downloader/response_status_count/200’: 1,
‘downloader/response_status_count/302’: 2,
‘downloader/response_status_count/500’: 3,
‘elapsed_time_seconds’: 0.426249,
‘finish_reason’: ‘finished’,
‘finish_time’: datetime.datetime(2021, 12, 30, 6, 44, 52, 358419),
‘httpcompression/response_bytes’: 80999,
‘httpcompression/response_count’: 1,
‘log_count/DEBUG’: 17,
‘log_count/ERROR’: 1,
‘log_count/INFO’: 10,
‘response_received_count’: 2,
‘retry/count’: 2,
‘retry/max_reached’: 1,
‘retry/reason_count/500 Internal Server Error’: 2,
‘robotstxt/request_count’: 1,
‘robotstxt/response_count’: 1,
‘robotstxt/response_status_count/500’: 1,
‘scheduler/dequeued’: 2,
‘scheduler/dequeued/memory’: 2,
‘scheduler/enqueued’: 2,
‘scheduler/enqueued/memory’: 2,
‘start_time’: datetime.datetime(2021, 12, 30, 6, 44, 51, 932170)}
2021-12-30 14:44:52 [scrapy.core.engine] INFO: Spider closed (finished)

Process finished with exit code 0

写回答

1回答

bobby

2021-12-31

settings中是不是没有关闭 

ROBOTSTXT_OBEY


0
2
bobby
回复
qq_慕神6513837
你留个qq 我加你看看
2022-01-02
共2条回复

Scrapy打造搜索引擎 畅销4年的Python分布式爬虫课

带你彻底掌握Scrapy,用Django+Elasticsearch搭建搜索引擎

5795 学习 · 6290 问题

查看课程