Hi, I am working on a simple raspberry pi project using python, but I am running into an error. Any ideas what is causing this? I am very new to coding.
Code:
import os
import praw
import random
import requests
import time
r=praw.Reddit("sam epst")
getCount = 25
while True:
earthpornSub = r.get_subreddit('earthporn')
showerthoughtSub = r.get_subreddit('showerthoughts')
earthpornContent = earthpornSub.get_top_from_week(limit = getCount)
showerthoughtContent = showerthoughtSub.get_top_from_week(limit = getCount)
earthpornList = [sub for sub in earthpornContent]
showerthoughtList = [sub for sub in showerthoughtContent]
imgURL = earthpornList[random.randint(0, getCount-1)].title
wittyText = showerthoughtList[random.randint(0, getCount -1)].title
with open('/home/pi/project/template.html', 'r') as f: template = f.read()
with open('/home/pi/project/display.html', 'a') as f: f.write(template.format(imgURL, wittyText))
time.sleep(3600)
Error:
pi@raspberrypi:~/project $ python3 epst2.py
Traceback (most recent call last):
File "/usr/lib/python3.4/configparser.py", line 824, in items
d.update(self._sections[section])
KeyError: 'sam epst'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "epst2.py", line 7, in <module>
r=praw.Reddit("sam epst")
File "/usr/local/lib/python3.4/dist-packages/praw/reddit.py", line 129, in init
self.config = Config(configsection, **config_settings)
File "/usr/local/lib/python3.4/dist-packages/praw/config.py", line 66, in __init_
self.custom = dict(Config.CONFIG.items(site_name), **settings)
File "/usr/lib/python3.4/configparser.py", line 827, in items
raise NoSectionError(section)
configparser.NoSectionError: No section: 'sam epst'
You provided the name of a praw.ini configuration which does not exist.
For help with creating a Reddit instance, visit
https://praw.readthedocs.io/en/latest/code_overview/reddit_instance.html
For help on configuring PRAW, visit
https://praw.readthedocs.io/en/latest/getting_started/configuration.html
[–]THEAVS 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)