I am learning to make a discord bot in python, and I need something from the dotenv module (load_dotenv).
I am using the following code
import discord
from dotenv import load_dotenv
load_dotenv()
TOKEN = 'this token thing'
client = discord.Client()
@client.event
async def on_ready():
print("UwU")
client.run(my token)
Right after I imported load_env I initialize it (I believe), therefor using it. When I run the .py I get the error that you get when you have a circular import.
Here's the error
File "/Users/yeet/PycharmProjects/discord-bots/bot.py", line 2, in <module>
from dotenv import load_dotenv
ImportError: cannot import name 'load_dotenv' from 'dotenv' (/Users/yeet/PycharmProjects/discord-bots/venv/lib/python3.8/site-packages/dotenv/__init__.py)
I read this post about it and I kind of get it but I don't see how it resonates with my situation, which is why I am posting this. I saw a solution in the provided post that said to use %reset
in the iPython terminal app. Let me know if that seems like a good idea. I didn't do it because I don't like installing extra stuff that I may not use or need?
Anyways, any ideas to why this error is appearing?
EDIT: So I have tried to install the python-dotenv module, but the error still occurs. I tried installing the python-dotenv-run and I may have solved the previous problem, but maybe have another one? The package has the description: "Run command with enviorment populated by the .env file"
Error after installing python-dotenv-run: https://pastebin.com/qtMFRdem