ModuleNotFoundError: No module named 'env._secrete'; 'env' is not a package #23
Unanswered
xianhua2020
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Beta Was this translation helpful? Give feedback.
1 reply
-
Using python-dotenv for Discord CredentialsStep 1: Install python-dotenvIf not already installed, you can add it to your project by running: pip install python-dotenvStep 2: Create a .env FileIn your project root, create a file named
Step 3: Modify the Import in Your CodeReplace the current import statement with code that uses dotenv to load the environment variables: from dotenv import load_dotenv
import os
load_dotenv() # This loads the .env file at the project root
discord_notify_Token = os.getenv('DISCORD_NOTIFY_TOKEN')
channel_id_general = os.getenv('CHANNEL_ID_GENERAL')Step 4: Adjust Any ReferencesIf other parts of your codebase reference |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Exception has occurred: ModuleNotFoundError
No module named 'env._secrete'; 'env' is not a package
AttributeError: module 'env' has no attribute 'path'
During handling of the above exception, another exception occurred:
File "D:\Python Scripts\Program-Trading-Based-on-Webull-main\discord_bot\discord_notify_bot.py", line 6, in
from env._secrete import discord_notify_Token, channel_id_general
ModuleNotFoundError: No module named 'env._secrete'; 'env' is not a package
I did install env-0.1.0
Please help
Beta Was this translation helpful? Give feedback.
All reactions