scrapy 'TelnetConsole' object has no attribute 'port'报错
(crawl_scrapy) D:\Project\PythonProject\crawl\scrapy\myspider>scrapy crawl itcast 2020-07-02 18:26:02 [scrapy.utils.signal] ERROR: Error caught on signal handler: <bound method TelnetConsole.start_listening of <scrapy.extensions.telnet.TelnetConsole object at 0x0000026FB7 8D8FA0>> Traceback (most recent call last): File "f:\pyenvs\crawl_scrapy\lib\site-packages\scrapy\utils\defer.py", line 164, in maybeDefe rred_coro result = f(*args, **kw) File "f:\pyenvs\crawl_scrapy\lib\site-packages\pydispatch\robustapply.py", line 55, in robust Apply return receiver(*arguments, **named) File "f:\pyenvs\crawl_scrapy\lib\site-packages\scrapy\extensions\telnet.py", line 65, in star t_listening self.port = listen_tcp(self.portrange, self.host, self) File "f:\pyenvs\crawl_scrapy\lib\site-packages\scrapy\utils\reactor.py", line 22, in listen_t cp return reactor.listenTCP(x, factory, interface=host) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\posixbase.py", line 495, in l istenTCP p.startListening() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 1356, in startL istening skt = self.createInternetSocket() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 1340, in create InternetSocket s = base.BasePort.createInternetSocket(self) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\base.py", line 1201, in creat eInternetSocket fdesc._setCloseOnExec(s.fileno()) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\fdesc.py", line 48, in _setCl oseOnExec flags = fcntl.fcntl(fd, fcntl.F_GETFD) AttributeError: module 'fcntl' has no attribute 'F_GETFD' 2020-07-02 18:26:03 [scrapy.downloadermiddlewares.robotstxt] ERROR: Error downloading <GET http ://www.itcast.cn/robots.txt>: module 'fcntl' has no attribute 'F_GETFD' Traceback (most recent call last): File "f:\pyenvs\crawl_scrapy\lib\site-packages\scrapy\core\downloader\middleware.py", line 44 , in process_request return (yield download_func(request=request, spider=spider)) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\endpoints.py", line 578, in c onnect self._reactor.connectTCP( File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\posixbase.py", line 500, in c onnectTCP c.connect() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\base.py", line 1132, in conne ct self.transport = transport = self._makeTransport() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 1548, in _makeT ransport return Client(self.host, self.port, self.bindAddress, self, self.reactor) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 736, in __init_ _ skt = self.createInternetSocket() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 572, in createI nternetSocket fdesc._setCloseOnExec(s.fileno()) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\fdesc.py", line 48, in _setCl oseOnExec flags = fcntl.fcntl(fd, fcntl.F_GETFD) AttributeError: module 'fcntl' has no attribute 'F_GETFD' 2020-07-02 18:26:03 [scrapy.core.scraper] ERROR: Error downloading <GET http://www.itcast.cn/ch annel/teacher.shtml> AttributeError: module 'fcntl' has no attribute 'F_GETFD' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "f:\pyenvs\crawl_scrapy\lib\site-packages\scrapy\core\downloader\middleware.py", line 44 , in process_request return (yield download_func(request=request, spider=spider)) File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\endpoints.py", line 578, in c onnect self._reactor.connectTCP( File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\posixbase.py", line 500, in c onnectTCP c.connect() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\base.py", line 1132, in conne ct self.transport = transport = self._makeTransport() File "f:\pyenvs\crawl_scrapy\lib\site-packages\twisted\internet\tcp.py", line 1548, in _makeT
一定要从头看错误日志,从根源上解决。我的是把python下的lib\fcntl.py删除