PRAW can't seem to find praw.ini files created during program run-time
See original GitHub issueDescribe the bug I have an algorithm that catches the Reddit instance not finding a praw.ini file and creates one, then goes back and re-creates the Reddit instance, however, even after the file is created, it can’t find anything. If I close the program and re-run after the file is created, it works fine.
To Reproduce Steps to reproduce the behavior:
- Create a small write algorithm (or I can send mine) that creates a praw.ini file from user inputs
- Initiate Reddit without a praw.ini file
- Have the error caught and redirected to the file-creation algorithm
- Have it than attempt to initiate again once the new file is created
Expected behavior I expected it to return to the beginning of my while loop, recognise that there is now a sufficient praw.ini file, and continue with the porgram.
Code/Logs I’m including the Reddit() instance because 1. it doesn’t have any private credentials visible due pulling them from a .ini file, and 2. it’s the problem.
instance = False
attempts = 0
while instance == False:
if attempts == 3:
print("Could not find required praw.ini attributes after 3 attempts. Exiting.")
sys.exit(0)
try:
reddit = praw.Reddit("cdrcredentials", user_agent=config["os"]+":claimdoneremover:v"+version+" (by u/MurdoMaclachlan)")
instance = True
except (configparser.NoSectionError, praw.exceptions.MissingRequiredAttributeException):
createIni(home)
attempts += 1
Logs-wise, it isn’t throwing any errors or giving log messages, it’s just going back into the except and calling createIni() again. I can send createIni() if need be, but it’s only a simple file-creation function, and itself is working exactly as intended.
System Info
- OS: Linux (Slackware 14.2)
- Python: 3.7
- PRAW Version: 7.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
I think it’d be acceptable to have a way to replace the global config with a new one, or to reload an existing one.
This issue was closed because it has been stale for 10 days with no activity.