#๐Ÿ”’ Need help coding

79 messages ยท Page 1 of 1 (latest)

shadow stag
#

Can someone tell me what I'm doing wrong?

visual haloBOT
#

@shadow stag

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

errant copper
#

you should be using a .env file to have your token

#

can you send the rest of your code (without the token)

shadow stag
#

Like the one provided

errant copper
shadow stag
shadow stag
errant copper
#

im just telling you best practice lol

shadow stag
#

File name?

errant copper
shadow stag
#

Ohh

#

What about the .py tho?

errant copper
#

to read from in, you need to
pip install python-dotenv

errant copper
#

you can make another file called .env

shadow stag
#

Ok, then what do I do with that file?

errant copper
#

to read from the .env file, make sure its in the same root folder, then

from dotenv import load_dotenv
import os
load_dotenv()
token = os.getenv("DISCORD_TOKEN")
errant copper
shadow stag
#

Ok so

#

Make a new file

#

Open it

errant copper
#

put that in the .env file yes

#

you can replace "DISCORD_TOKEN" with anything if you want

shadow stag
#

Kk

errant copper
#

then access it with os.getenv("put the same name here")

errant copper
shadow stag
errant copper
shadow stag
#

Like one I'm coding in

#

Py

errant copper
#

what ide/code editor are you using

shadow stag
#

Py

rustic yarrow
errant copper
#

like the code editor

shadow stag
#

Well do online

errant copper
#

what are you using to code it

shadow stag
#

Go*

rustic yarrow
#

o alright

shadow stag
errant copper
#

hm

#

just write
pip install python-dotenv
in your terminal

errant copper
shadow stag
#

Lemme do file now

#

@errant copper ive done this

errant copper
#

the .env file should be in the same folder as your bot file

shadow stag
#

ohh

errant copper
#

or you cant read it

shadow stag
#

@errant copper now it says Bash: pip: command not found

errant copper
errant copper
#

like the discord module

#

did you install the discord module

shadow stag
errant copper
shadow stag
#

Sorry man, I'm super new..

errant copper
#

could you try py -m pip install python-dotenv

shadow stag
#

This is super hard..

shadow stag
#

@errant copper so uh, what do I do..

errant copper
shadow stag
errant copper
shadow stag
#

I just downloaded the file from python

#

I had to use Linux

#

Cuz I'm on chrome

errant copper
#

hm

#

try
python -v
py -v
py3 -v
python3 -v

#

I dont know what python is called on your system, if any of these give you the python version, its the correct one

shadow stag
#

Kk I'll try that when I can

visual haloBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.