DEV Community

Discussion on: Let's make a Twitch bot with Python!

Collapse
 
mrbackbreaker_ profile image
Angry Bob

I have a problem at the point where i have to wake the bot up with "pipenv run python bot.py". It keeps saying "Loading .env environment variables…" but nothing more. Its just stuck at this point and doesnt even give me an error.
I would really appreciate an answer since im stuck here for several hours and its driving me nuts. Thank you in advance

Collapse
 
pesteaux profile image
pesteaux

Hi I am having the same problem and can't get around it. I am stuck on this error. Did anyone get a fix? The name/channel seems to be key but I can't get a working combination. I don't understand the user who said the nick is the channel.

Collapse
 
erosika profile image
erosika • Edited

Not sure if its actually an issue to be stuck on "Loading .env environment variables…" because I can continue with the rest of the code, and my bot does go online.

This happens when my Bot_Nick and Channel are the same. Before making my Bot_Nick the same as my channel name, I was having the "channel does not exist" error. If I make my Bot_Nick my channel name, it doesn't seem to matter what the Channel input is, because the bot still goes online as my channel name.

Would love to see this fixed because it's very easy to get running otherwise!

Collapse
 
lukasdim27 profile image
Lukas Dimitroff

Bot_Nick is not a nickname, it is the name of the channel.

Collapse
 
zakdugie profile image
Dugie

Same problem, eventually when trying to abort it prints this error:
C:\Users\User.virtualenvs\Chatbot_work--fd3mIVH\lib\site-packages\twitchio\websocket.py:618: RuntimeWarning: coroutine 'WebSocketCommonProtocol.close' was never awaited
self._websocket.close()

Collapse
 
seanlodhammar profile image
Sean Lodhammar

The reason "Loading .env environment variables..." will stay, is because there is nothing to print to the console afterwards. In the "event_ready" function, if you print something, then there will be output.

Collapse
 
xninjarose profile image
Ninja | Rose [A+,Net+]

If it says nothing more and your still at beginning of tutorial, then you did it right, it's in the channel, do the next step and it should put a message in chat like it says in tutorial

Collapse
 
holphana profile image
Holly Pennington • Edited

I'm so sorry that it took someone more than a year to find this but this is a super easy fix that was not very clear in the guide.

(the following example has a couple extra spaces to avoid formatting)

the:
if __ name __ == "__ main __":
bot.run()

must go at the bottom of your bot.py file

if there are functions after it, it will not load.