I am making a program in python that I plan to host on github. I have a .env
file containing an api token. I tried to import it into my code like so:
first i installed the python-dotenv
library by typing pip install python-dotenv
in the command prompt. python-dotenv
shows when i type pip list
.
then in my code:
import os
from dotenv import load_dotenv
load_dotenv()
example = os.getenv('TOKEN')
from dotenv import load_dotenv
gives the error Import "dotenv" could not be resolved Pylancereport (MissingImports)
and my code will not run. Is there anything i'm doing wrong? How can i fix it?