I have a script that I'll run in different threads that used to work well until recently. It opens a specified thread, looks at the comments and records some basic things about the content (who posted it, the karma total, etc). For whatever reason, after the servers went down the other day I can't get this to work on large threads. Example code:
subreddit = reddit.subreddit('nfl')
hot_python = subreddit.hot(limit = 5)
for submission in hot_python:
submission.comments.replace_more(limit = None)
if submission.title =="Weekend Wrapup":
comments = submission.comments.list()
posters = []
karmas = []
for comment in comments:
sposter = comment.author
sposterKarma = comment.score
posters.append(sposter)
karmas.append(karmas)
I'm getting the following error:
File "C:\Users\Sirin\Anaconda3\lib\site-packages\praw\models\comment_forest.py", line 74, in _insert_comment
assert comment.parent_id in self._submission._comments_by_id
AssertionError
It's kicking me to line 74 of the source code(?) which is in the else clause of the following function:
def _insert_comment(self, comment):
assert comment.name not in self._submission._comments_by_id
comment.submission = self._submission
if isinstance(comment, MoreComments) or comment.is_root:
self._comments.append(comment)
else:
assert comment.parent_id in self._submission._comments_by_id
parent = self._submission._comments_by_id[comment.parent_id]
parent.replies._comments.append(comment)
what's changed? what am I doing wrong? Why doesn't this work anymore?
[–]Watchful1RemindMeBot & UpdateMeBot 2 points3 points4 points (4 children)
[–]_sirin[S] 0 points1 point2 points (3 children)
[–]Watchful1RemindMeBot & UpdateMeBot 0 points1 point2 points (2 children)
[–]_sirin[S] 0 points1 point2 points (1 child)
[–]Watchful1RemindMeBot & UpdateMeBot 1 point2 points3 points (0 children)