Ask coding questions

← Back to all posts
Os says it has no attribute, not sure how to fix!
Chickenpotato2 (1)

I used to code like 7 years ago, getting back into it now, made sure there weren't any extra spaces (my biggest problem when coding lol) I'm not sure how to fix this to make it realize what I'm doing! Thank you for any help you can give me!

Comments
hotnewtop
figglediggle (136)

try importing module getdnd from os

LukeWright (114)

try

token = os.environ.get("TOKEN")
client.run(token)

Thats how I did it for my bot

Chickenpotato2 (1)

@LukeWright just tried it, maybe it's a difference in code from discord to here not 100% sure, still didn't work, thank you for helping!

Chickenpotato2 (1)

Ope stuff is updating, maybe that will fix it

LukeWright (114)

it's probably formatted differently. I have my file with the token in it called .env which i read makes it so that other replers cannot see your token. maybe if you rename .dnd to .env it would work. @Chickenpotato2

Chickenpotato2 (1)

@LukeWright thank you it's working now! :)

Chickenpotato2 (1)

My token is spelled the same as what I want it to grab, maybe I'm using the wrong attribute?