You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to get a discord bot to work, so I got round a bunch of Linux issues, and finally managed to get everything in place and I get loads of errors.
Reproduction Steps
harry@debian:~/Code/Python$ python3.8 Bot.py
(Screenshots show the python code)
Expected Results
The code to run.
Actual Results
Traceback (most recent call last):
File "Bot.py", line 15, in
client.run(TOKEN)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 678, in run
return future.result()
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 658, in runner
await self.start(*args, **kwargs)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 621, in start
await self.login(*args, bot=bot)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 472, in login
await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'
Checklist
[ x] I have searched the open issues for duplicates.
[ x] I have shown the entire traceback, if possible.
[ x] I have removed my token from display, if visible.
In the first screenshot, you've leaked a large portion of your token, so you might want to regenerate it now if you haven't already.
In that screenshot, you're attempting to get an environment variable with the name being your token itself. os.getenv returns None by default if an environment variable with that name/key isn't found, and that's what's happening here. TOKEN is None, and that causes subsequent errors when it's passed to Client.run.
You likely need to change your call to os.getenv to use the name/key of the environment variable rather than the value of it.
Otherwise, you can just use the token directly as a string.
As explained though, this is not an issue with discord.py, and for future questions like this, you should join either the official discord.py server or the Discord API server for help, as the README also links.
Summary
I am trying to get a discord bot to work, so I got round a bunch of Linux issues, and finally managed to get everything in place and I get loads of errors.
Reproduction Steps
harry@debian:~/Code/Python$ python3.8 Bot.py
(Screenshots show the python code)
Expected Results
The code to run.
Actual Results
Traceback (most recent call last):
File "Bot.py", line 15, in
client.run(TOKEN)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 678, in run
return future.result()
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 658, in runner
await self.start(*args, **kwargs)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 621, in start
await self.login(*args, bot=bot)
File "/home/harry/.local/lib/python3.8/site-packages/discord/client.py", line 472, in login
await self.http.static_login(token.strip(), bot=bot)
AttributeError: 'NoneType' object has no attribute 'strip'
Checklist
System Information
harry@debian:~/Code/Python$ python3.8 -m discord -v
harry@debian:~/Code/Python$
The text was updated successfully, but these errors were encountered: