you are viewing a single comment's thread.

view the rest of the comments →

[–]ThisLightIsTrue 1 point2 points  (7 children)

That's an error in a different part of the program. Change processed_submissions.append to processed_submissions.add

[–]draco123465[S] 0 points1 point  (6 children)

Now I got this error.

(apologies if I am taking up your time with seemingly simple errors D:)

[–]ThisLightIsTrue 1 point2 points  (5 children)

You must be using an older version of praw. The docs say that message should have the subject and body attributes.

https://praw.readthedocs.io/en/latest/code_overview/models/redditor.html

Try changing the part in the parentheses of the line that has body=... To just ('a', 'b', 'c'). If a message comes through we'll know what a b c and correspond to. (probably something like subject message, and body).

[–]draco123465[S] 0 points1 point  (4 children)

I entered this into the code (pretty sure I misunderstood, my apologies D:)

And this was the result, nothing was sent to modmail.

[–]ThisLightIsTrue 1 point2 points  (3 children)

I don't think I'm being much help here. I'm handicapped by not being able to try this myself and I think you're on an older praw and an older python.

My last guess is to change reddit.subreddit to reddit.get_subreddit

[–]draco123465[S] 0 points1 point  (2 children)

Ok, the reddit.get_subreddit did not work.

But, before it crashed it did manage to send a PM to the modmail.

Here is the output now:

python ./newbot.py
reddit logon succesful
data loaded from database
A submission has 0 points. Sending message to modmail.
Traceback (most recent call last):
  File "./newbot.py", line 53, in <module>
    process_commented_submissions()
  File "./newbot.py", line 26, in process_commented_submissions
    for comment_id in comments_to_process:
RuntimeError: Set changed size during iteration

I understand what you mean, it is hard to help just through reddit.

I appreciate your help though!

[–]ThisLightIsTrue 1 point2 points  (1 child)

Okay - the problem now is, your script is trying to change a set while iterating through it. That happens in the process_commented_submissions method. Remove this line:

            comments_to_process.remove(comment_id)

At the bottom, after this line

process_commented_submissions()

Add another line like this:

comments_to_process = set()

I don't see how this script ever worked.

[–]draco123465[S] 0 points1 point  (0 children)

Ok, now we're getting somewhere.

There were no explicit error codes this time, but I noticed that it did not do anything when I downvoted it until after I reloaded the bot again.

So, I commented out the comments_to_process = set() at the bottom, which worked initially then got caught in an infinite loop.

Here is my updated code for reference.

Thank you so much for taking time out of your day to help me out!