Skip to main content
 首页 » 编程设计

python之调用 `praw.helpers` 导致 AttributeError : 'module' object has no attribute 'helpers'

2025年02月15日13qlqwjy

我正在尝试为我的 Reddit 机器人运行代码。它可以毫无问题地登录 Reddit,但是当它到达这段代码时,它会抛出一个错误:

all_comments = praw.helpers.flatten_tree(r.get_comments('all')) 

它抛出的错误:

AttributeError: 'module' object has no attribute 'helpers' 

我已经检查过帮助程序文件位于 A:\Python27\Lib\site-packages\praw\models\helpers.py。

请您参考如下方法:

您正在查看 PRAW4 之前的 PRAW 版本的示例,但是,您已经安装了 PRAW4。

如果您想使用它,请查看 PRAW4 文档:https://praw.readthedocs.io/en/latest/getting_started/quick_start.html