小编Eri*_*v99的帖子

Scrapy Pyinstaller OSError:无法获取源代码/twisted.internet.defer._DefGen_Return

我正在尝试使用 pyinstaller 将一个非常简单的爬虫蜘蛛发布为 .exe。我已经搜索并阅读了我能找到的所有内容,但我仍然无法弄清楚出了什么问题。任何正确方向的帮助或指示都非常有用!

如果我将 yield 更改为 return 它不会给我错误并且可以正常工作,除了它只返回 1 个项目(这是正常的,因为它是 return 而不是 yield。)代码工作得很好,我的 IDE 中没有任何错误(不使用 pyinstaller .exe)

注意:我使用的是 pyinstaller 开发版本。

运行我的 .exe 时出错

2020-04-28 11:57:30 [scrapy.core.scraper] ERROR: Spider error processing <GET http://books.toscrape.com/> (referer: None)
Traceback (most recent call last):
  File "lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks
  File "lib\site-packages\scrapy\core\downloader\middleware.py", line 42, in process_request
  File "lib\site-packages\twisted\internet\defer.py", line 1362, in returnValue
twisted.internet.defer._DefGen_Return: <200 http://books.toscrape.com/>

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "lib\site-packages\scrapy\utils\defer.py", line 55, in …
Run Code Online (Sandbox Code Playgroud)

python twisted pyinstaller scrapy python-3.x

6
推荐指数
1
解决办法
523
查看次数

标签 统计

pyinstaller ×1

python ×1

python-3.x ×1

scrapy ×1

twisted ×1