configparser.MissingSectionHeaderError: File contains no section headers. Reddit bot

Viewed 341

I'm making a reddit bot. But when I try to run it, I get the error

configparser.MissingSectionHeaderError: File contains no section headers.

I have my praw.ini file placed into $HOME/.config, as the documentation states to do. My file looks like this:

 #!/usr/bin/python
import praw

reddit = praw.Reddit('bot1')

subreddit = reddit.subreddit("learnpython")

for submission in subreddit.hot(limit=5):
    print("Title: ", submission.title)
    print("Text: ", submission.selftext)
    print("Score: ", submission.score)
    print("---------------------------------\n")

I'm following the reddit bot tutorial by learnpython, and I don't know why it isn't working. My praw.ini file is here:

submission_kind=t3
subreddit_kind=t5
oauth_url=https://oauth.reddit.com
reddit_url=https://www.reddit.com
short_url=https://redd.it
[bot1]
client_id='ryg5shdn6Hbs'
client_secret= 'ePLMUKgMuh5GBbs58jdlsu52'
password='Icethebear10'
username='attherealicebear'
user_agent='omegapybot 0.1'

Don't worry those aren't my real details, and the username is a second account, not my main.

1 Answers

Ok a figured it out, just put [DEFAULT] at the top of the praw.ini

Related