简体   繁体   中英

environment variables not updating

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'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM