I am using the dotenv package. I had a key that I had saved in my .env file but I updated it to a new key, but my script still outputs the old key. I have the ".env" file in the root directory.
I thought that by using load_dotenv() that it's taking in the new keys whatever they may be at the current state in time and saving it to be used in the script. What am I doing wrong?
import os
from dotenv import load_dotenv
import praw
load_dotenv()
reddit = praw.Reddit(client_id=os.getenv('reddit_personal_use'),
client_secret=os.getenv('reddit_api_key'),
user_agent=os.getenv('reddit_app_name'),
username=os.getenv('reddit_username'),
password=os.getenv('reddit_pw'))
I had to set override=True
load_dotenv(override=True)
load_dotenv does not override existing System environment variables. To override, pass override=True to load_dotenv().
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With