Questions tagged [praw]

PRAW (Python Reddit API Wrapper) is a python package used to access and interact with the reddit API.

PRAW, short for Python Reddit API Wrapper, is a python package that allows for simple access to ’s API. PRAW aims to be as easy to use as possible and is designed to follow all of reddit’s API rules. You have to give a useragent that follows the rules, everything else is handled by PRAW so you needn’t worry about violating them.

617 questions
-1
votes
1 answer

Python read from a file, and only do work if a string isn't found

So I'm trying to make a reddit bot that will exec code from a submission. I have my own sub for controlling these clients. while __name__ == '__main__': string = open('config.txt').read() for submission in subreddit.get_new(limit = 1): …
Ben Smith
  • 13
  • 2
-1
votes
1 answer

Python is not recognizing text file that is in the same directory?

My current project tree: redditbot/ -- commands/ ----__init__.py ----comment_cache.txt ----readcomments.py --mainbot.py What I am attempting to do is read the comment_cache.txt file via open('comment_cache.txt')in the readcomments.py…
Aaron
  • 445
  • 1
  • 4
  • 11
-1
votes
1 answer

Unicode Error when trying to process blank character text in PRAW

I'm using the reddit-flair-bot for my subreddit. If you're not familiar with this, it's a python script that handles incoming PMs from users, where it takes the subject as the flair class and the content of the PM as the flair text. That's just a…
antonlab
  • 323
  • 3
  • 5
  • 11
-1
votes
1 answer

Incorrect conversion from epoch time when scraping web

import praw,time import sys reload(sys) sys.setdefaultencoding("utf-8") username="" password="" r = praw.Reddit(user_agent='') r.login(username,password,disable_warning=True) posts=r.search('china disaster', subreddit=None, sort=None, syntax=None,…
Abhishek Bhatia
  • 9,404
  • 26
  • 87
  • 142
-1
votes
1 answer

Get Users Comment Karma Broken Down by Subreddit?

I'm sure this is simple but I'm at a loss; How do I get a user's comment karma broken down by subreddit? I can get the link Karma as demonstrated on the praw tutorial and I can retrieve comments but I can't seem to figure out where I can get the…
-2
votes
1 answer

Praw not responding

I dont really know why my code doesn't work. When my Reddit bot gets a message or comment with "+makeaccount" it should "contact" bitcoind and make an account with "getnewaddress" and print a message to the console, but it doesn't seem to even print…
IdotMaster1
  • 41
  • 2
  • 6
-2
votes
1 answer

My Discord bot returns an error when I want it to send reddit memes. How do I fix this?

I wrote a code for a Discord bot so that it could send memes from the meme sub reddit but whenever I try it, it doesn't work. Here is the code: import Discord import praw reddit = praw.Reddit(client_id='#', client_secret='#', …
-2
votes
1 answer

Want to resume python bot

I run my python bot, the server restarts, I start the python bot again, I want the python bot to resume from where it stopped before the server restarted, like create a paused file or something. I'm using replit so the servers tend to restart…
-2
votes
1 answer

NameError: name 'filename' is not defined

I am trying to follow reddit u/busterroni's video on how to make a reddit bot, but while his program runs fine, mine keeps getting hung up on "filename" on the line below that says... usernames = get_usernames(filename) ...under main(). Can anyone…
bluewizard3
  • 19
  • 1
  • 1
  • 7
-2
votes
1 answer

Python issues with objects inside of dictionary? Cant get all data back out

Sorry this is the second post in two days.. I am pulling my hair out with this. I am attempting to take data from reddit and put it into an array in a way I can pull the data out later for tensorflow to parse it. Now the issue is my second object…
Mal229
  • 129
  • 1
  • 3
  • 10
-2
votes
1 answer

How to make a reddit bot invoke a username using PRAW

I have been playing with PRAW to build reddit bots. While it is easy to build a bot that auto responds generic messages to triggered keywords, I want to build something that is a bit more interactive. I am trying to build a reddit bot that invokes…
iamthewalrus
  • 77
  • 1
  • 7
-3
votes
1 answer

How to exclude certain key words in discord.py bot

I am buiding a discord bot with dicord.py and praw and I want to exclude all video and gallery posts since they don't embed properly in discord. I tried using a in statement and telling it to search for a new post again but it still does not work.…
NeoFox
  • 13
  • 4
-3
votes
1 answer

How to get a user object in Praw?

I'm attempting to find the user of Reddit so I can iterate through their last comments, weird reason but I'm in need of getting the user's object. Cannot find in the docs where there's a way to get a user via username.
H. Joseph
  • 65
  • 9
-3
votes
3 answers

Error: unindent does not match any outer indentation level (Making a reddit bot)

So, I'm new to Python in all. I tried my hand at making a reddit bot, I fixed most errors. But this one kinda started beating my head in as I tried fixing it. print("String with \"best girl\" found in comment", str(comment.id)) IndentationError:…
-4
votes
1 answer

jenv.bash: No such file or directory

I am getting the following error when trying to run my code in Python: -bash: /usr/local/Cellar/jenv/0.2.0-201404260/libexec/../completions/jenv.bash: No such file or directory Here is my code: #!/usr/bin/python # -*- coding: utf-8 -*- import…
1 2 3
41
42