Debug无法调试,正常运行没有问题

来源:2-1 pycharm的安装和简单使用

weixin_慕容4563607

2024-03-01

debug调试时:

2024-03-01 08:59:42 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.bilibili.com/> (referer: None)
2024-03-01 08:59:42 [asyncio] ERROR: Exception in callback <Task pending name='Task-1' coro=<SpiderMiddlewareManager.scrape_response.<locals>.process_callback_output() running at C:\xxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\scrapy\core\spidermw.py:295> cb=[Deferred.fromFuture.<locals>.adapt() at C:\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\twisted\internet\defer.py:1063]>()
handle: <Handle <Task pending name='Task-1' coro=<SpiderMiddlewareManager.scrape_response.<locals>.process_callback_output() running at C:\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\site-packages\scrapy\core\spidermw.py:295> cb=[Deferred.fromFuture.<locals>.adapt() at C:\xxxxxx\Local\Programs\Python\Python311\Lib\site-packages\twisted\internet\defer.py:1063]>()>
Traceback (most recent call last):
  File "C:\xxxxxx\AppData\Local\Programs\Python\Python311\Lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
TypeError: 'Task' object is not callable

正常运行:

2024-03-01 09:08:37 [scrapy.core.scraper] DEBUG: Scraped from <200 https://api.bilibili.com/x/web-interface/view?bvid=BV1qr421p7Cm>
{'BVid': ['BV1qr421p7Cm'],
 'CID': [1453571080],
 'coins': [2408],
 'doggies': [17139],
 'title': ['【星铁丨花火】“必要时,我就是乐子”'],
 'urls': ['https://www.bilibili.com/video/BV1qr421p7Cm'],
 'whole_views': [125189]}
写回答

1回答

bobby

2024-03-01

https://youtrack.jetbrains.com/issue/IDEA-331676/Debugger-fails-with-FastAPI-uvloop-TypeError-Task-object-is-not-callable 这个问题应该是和pycharm有关, https://img1.sycdn.imooc.com/szimg/65e1974009958ea210200082.jpg 可以试试这个,或者换个版本的pycharm试试

1
2
bobby
回复
weixin_慕容4563607
好的.
2024-03-05
共2条回复

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

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

5796 学习 · 6290 问题

查看课程