Replit Discord bot env error

HI I Was following discord python bot tutorial an i came across this error.

Traceback (most recent call last):
File “main.py”, line 13, in
client.run(my_secret = os.environ[‘TOKEN’])
File "/opt/virtualenvs/python3/lib/python3.8/site-packa
Traceback (most recent call last):
File “main.py”, line 13, in
client.run(my_secret = os.environ[‘TOKEN’])
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 723, in run
return future.result()
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 702, in runner
await
Traceback (most recent call last):
File “main.py”, line 13, in
Traceback (most recent call last):
File “main.py”, line
Traceback (most recent call last):
File “main.py”, line 13, in
client.run(my_secret = os.environ[‘TOKEN’])
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 723, in run
return future.result()
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 702, in runner
await self.start(*args, **kwargs)
File “/opt/virtualenvs/python3/lib/python3.8/site-packages/discord/client.py”, line 663, in start
raise TypeError(“unexpected keyword argument(s) %s” % list(kwargs.keys()))
TypeError: unexpected keyword argument(s) [‘my_secret’]

Can You Help ME

Hi @daudau425 !

Welcome to the forum!

If your my_secret variable looks something like this

my_secret = os.environ['TOKEN']

Then you can just use that variable name inside the client.run

client.run(my_secret)

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.