【发布时间】:2019-05-30 16:25:39
【问题描述】:
我正在尝试从“memes”Reddit subreddit 上的前 10 个帖子中获取随机图像,但它给出了 E1101 pylint 错误。我似乎做的一切都是正确的。这是我的代码:
我似乎在这方面找不到任何东西。
reddit = praw.Reddit(client_id='my client ID',
client_secret='my client secret',
user_agent='my user agent',
username='username')
@commands.command()
async def meme(self):
memes = reddit.subreddit('memes').hot()
post_to_pick = random.randint(1, 10)
for i in range(0, post_to_pick):
submission = next(x for x in memes if not x.stickied)
【问题讨论】:
-
你能指出哪一行是 linter 抛出那个味精吗?
-
如果一个类在运行时使用
setattr创建属性,Pylint 无法检测到这些。看到这个问题stackoverflow.com/q/35990313/494134 -
@ThuYeinTun memes = reddit.subreddit('memes').hot() reddit 特别
-
Here's the line where
Reddit.subredditis defined。我希望你的 linter 能看到这一点。您的praw和pylint安装都是最新版本吗? -
praw 和 pylint 都更新了
标签: python bots discord discord.py praw