Traceback (most recent call last):
File "B:\ChatLoyalty\ChatLoyalty.py", line 7, in
irc_token=os.environ['TMI_TOKEN'],
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\os.py", line 675, in getitem
raise KeyError(key) from None
KeyError: 'TMI_TOKEN'
I figured this out. What you want to do is put in what is in these quotations for each of the environments into bot.py instead of .env.
"os.environ['TMI_TOKEN']=
os.environ['CLIENT_ID']=
os.environ['BOT_NICK']=
os.environ['BOT_PREFIX']=
os.environ['CHANNEL']=
"
For some reason, the OP didn't specify how to call the .env file before it tries to run the rest of bot.py, but doing that eliminates the need for .env
I'm getting the same issue and cannot figure out where to put your solution. I've tried putting the .env info directly into bot.py as variables to eliminate the need for the .env, and I still get the KeyError despite any changes I make. Where am I putting this info to fix this problem? Thank you!
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
i get this error
Traceback (most recent call last):
File "B:\ChatLoyalty\ChatLoyalty.py", line 7, in
irc_token=os.environ['TMI_TOKEN'],
File "C:\Users\user\AppData\Local\Programs\Python\Python38\lib\os.py", line 675, in getitem
raise KeyError(key) from None
KeyError: 'TMI_TOKEN'
what am i doing wrong?
I figured this out. What you want to do is put in what is in these quotations for each of the environments into bot.py instead of .env.
"os.environ['TMI_TOKEN']=
os.environ['CLIENT_ID']=
os.environ['BOT_NICK']=
os.environ['BOT_PREFIX']=
os.environ['CHANNEL']=
"
For some reason, the OP didn't specify how to call the .env file before it tries to run the rest of bot.py, but doing that eliminates the need for .env
I'm getting the same issue and cannot figure out where to put your solution. I've tried putting the .env info directly into bot.py as variables to eliminate the need for the .env, and I still get the KeyError despite any changes I make. Where am I putting this info to fix this problem? Thank you!