AttributeError: '<class 'praw.objects.MoreComments'>' has no attribute 'body'
<p>How can I fix this error?</p>

<pre><code>import praw

subreddit_name = 'relationships'
num_submissions = 30
r = praw.Reddit(user_agent="getting top posts from a subredit and its submissions", site_name='lamiastella')
subreddit = r.get_subreddit(subreddit_name)
top_submissions = subreddit.get_top_from_year(limit = num_submissions)

for submission in top_submissions:
        all_comments = praw.helpers.flatten_tree(submission.comments)
        submission.replace_more_comments(limit=None, threshold=0)
        if len(all_comments) &gt; 100:
                print(len(all_comments))
                #top_comments = all_comments.sort(key = lambda comment : comment.score, reverse = True)
                for comment in all_comments[:100]:
                        print(comment.body)
        else:
                continue
</code></pre>

<p>I get:</p>

<pre><code>Your mother would be very proud of you, you did an awesome job. Good luck with you and your father's therapy.
[removed]
[removed]
Traceback (most recent call last):
  File "getSubmissionsFromSubreddit.py", line 16, in &lt;module&gt;
    print(comment.body)
  File "/usr/local/lib/python2.7/dist-packages/praw/objects.py", line 92, in __getattr__
    raise AttributeError(msg)
AttributeError: '&lt;class 'praw.objects.MoreComments'&gt;' has no attribute 'body'
</code></pre>

<p>stupid mistake but should have had <code>submission.replace_more_comments(limit=None, threshold=0)</code> above     <code>all_comments = praw.helpers.flatten_tree(submission.comments)</code> line:</p>

<pre><code>import praw

subreddit_name = 'nostalgia'
num_submissions = 2
r = praw.Reddit(user_agent="getting top posts from a subredit and its submissions", site_name='lamiastella')
subreddit = r.get_subreddit(subreddit_name)
top_submissions = subreddit.get_top_from_year(limit = num_submissions, comment_sort='top')
for submission in top_submissions:
        submission.replace_more_comments(limit=None, threshold=0)
        all_comments = praw.helpers.flatten_tree(submission.comments)
        if len(all_comments) &gt; 100:
                print(len(all_comments)        all_comments = praw.helpers.flatten_tree(submission.comments))
                #top_comments = all_comments.sort(key = lambda comment : comment.score, reverse = True)
                for comment in all_comments[:10]:
                        print(comment.body)
        else:
                continue
</code></pre>

python attributeerror reddit praw reddit-api