其他分享
首页 > 其他分享> > Scrapy框架scrapy crawl article运行报错:exceptions.ImportError: cannot import name suppress

Scrapy框架scrapy crawl article运行报错:exceptions.ImportError: cannot import name suppress

作者:互联网

报错内容如下:

2022-07-06 14:39:32 [twisted] CRITICAL: Unhandled error in Deferred:

Traceback (most recent call last):
  File "e:\myproject\venv\lib\site-packages\scrapy\crawler.py", line 184, in crawl
    return self._crawl(crawler, *args, **kwargs)
  File "e:\myproject\venv\lib\site-packages\scrapy\crawler.py", line 188, in _crawl
    d = crawler.crawl(*args, **kwargs)
  File "e:\myproject\venv\lib\site-packages\twisted\internet\defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "e:\myproject\venv\lib\site-packages\twisted\internet\defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "e:\myproject\venv\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "e:\myproject\venv\lib\site-packages\scrapy\crawler.py", line 104, in crawl
    six.reraise(*exc_info)
  File "e:\myproject\venv\lib\site-packages\scrapy\crawler.py", line 86, in crawl
    self.engine = self._create_engine()
  File "e:\myproject\venv\lib\site-packages\scrapy\crawler.py", line 111, in _create_engine
    return ExecutionEngine(self, lambda _: self.stop())
  File "e:\myproject\venv\lib\site-packages\scrapy\core\engine.py", line 67, in __init__
    self.scheduler_cls = load_object(self.settings['SCHEDULER'])
  File "e:\myproject\venv\lib\site-packages\scrapy\utils\misc.py", line 46, in load_object
    mod = import_module(module)
  File "C:\Python27\Lib\importlib\__init__.py", line 37, in import_module
    __import__(name)
  File "e:\myproject\venv\lib\site-packages\scrapy\core\scheduler.py", line 7, in <module>
    from queuelib import PriorityQueue
  File "e:\myproject\venv\lib\site-packages\queuelib\__init__.py", line 1, in <module>
    from queuelib.queue import FifoDiskQueue, LifoDiskQueue
  File "e:\myproject\venv\lib\site-packages\queuelib\queue.py", line 7, in <module>
    from contextlib import suppress
exceptions.ImportError: cannot import name suppress

解决方法如下:

pip uninstall attrs
pip uninstall queuelib
pip install queuelib==1.5.0
pip install attrs

转自:[https://blog.csdn.net/tanya_yeah/article/details/121103248]

标签:venv,name,ImportError,py,site,报错,File,line,packages
来源: https://www.cnblogs.com/vetra/p/16450798.html