Reputation: 1
I am trying to get a random image from the top 10 posts on the "memes" Reddit subreddit, but it's giving a E1101 pylint error. I seem to have done everything correctly. Here is my code:
I cant seem to find anything on this.
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)
Upvotes: 0
Views: 274
Reputation: 2408
That's because pylint by default only trusts C extensions from the standard library and will ignore those that aren't.
As praw isn't part of stdlib, you have to whitelist it manually. To do this, navigate to the directory of your project in a terminal, and generate an rcfile for pylint:
$ pylint --generate-rcfile > .pylintrc
Then, open that file and add praw to the whitelist like so:
extension-pkg-whitelist=praw
After that, all E1101 errors regarding praw shouldn't appear anymore
Upvotes: 1