#๐Ÿ”’ what does this mean?

93 messages ยท Page 1 of 1 (latest)

scarlet torrent
#

Please help, i don't know what that means lol

flat stagBOT
#

@scarlet torrent

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.

scarlet torrent
#

i have this already

#
import discord
import audioop
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='.', intents=intents)

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}')

@bot.command()
async def hello(ctx):
    await ctx.send(f'Hello, {ctx.author.name}!')

bot.run("token")
cunning girder
#

get rid of that import

#

not sure why you have it

scarlet torrent
#

anything else?

#

still gives me the same errir

#

error*

swift basin
#

If you got rid of the import, it must be a different error, post the error

scarlet torrent
#

still gives the same

swift basin
#

Did you save the file after you got rid of the import audioop line?

scarlet torrent
#
import discord
from discord.ext import commands

intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix='.', intents=intents)

@bot.event
async def on_ready():
    print(f'We have logged in as {bot.user}')

@bot.command()
async def hello(ctx):
    await ctx.send(f'Hello, {ctx.author.name}!')

bot.run("token")```
cunning girder
#

Probably has something to do with the fact that you're using a pre release python

#

I see that audioop will be removed from python 3.13, though I don't see why import discord should throw an error directly

#

It's probably not worth your time to try and get this to work, you should consider using a stable version of python

scarlet torrent
#

currently using 3.12.6

cunning girder
#

take a gander at the bottom right of your vscode

#

you'll find that it says python 3.13

scarlet torrent
cunning girder
#

mhm

#

see how 3.13 is prerelease

scarlet torrent
#

it is

#

which shall i install?

cunning girder
#

that means it hasn't been released yet and isn't guaranteed to work correctly

cunning girder
#

the big yellow button

scarlet torrent
#

ah, thank you

#

already did

cunning girder
#

i.e. rmdir .venv; py -3.12 -m venv .venv

scarlet torrent
#

ok so now im lost

#

๐Ÿ’€

cunning girder
#

at some point you created a virtual environment

#

you named it venv

scarlet torrent
#

yea

cunning girder
#

you put it in /DE-IT Projects/venv/

cunning girder
frank tiger
#

Delete the entire venv folder.

cunning girder
#

that venv is a python3.13 environment

#

delete the folder

scarlet torrent
#

done

cunning girder
#

then, you can create a python 3.12 environment in it's place by using the command py -3.12 -m venv venv

scarlet torrent
#

py : The term 'py' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is
correct and try again.
At line:1 char:1

  • py -3.12 -m venv venv
  • ~~
    • CategoryInfo : ObjectNotFound: (py:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException
cunning girder
#

did you mess with the installation options in the python installer?

#

if not, just restart vscode and try again

frank tiger
#

Interesting. You installed Python on windows but don't have the py launcher that comes bundled with it.

cunning girder
#

if you did, you shouldn't have

scarlet torrent
cunning girder
#

click cancel

scarlet torrent
cunning girder
#

great, cancel

shadow lynx
# scarlet torrent

I recommend that you get a new token NOW. as the one you now use is public and can be stolen. I also recommend that you store you token in your computers environment variables and read off that instead of plain-text.

scarlet torrent
#

now it gave me a error in my terminal

cunning girder
scarlet torrent
cunning girder
#

You need to restart vscode

#

close it and reopen it

scarlet torrent
#

i did

#

Traceback (most recent call last):
File "C:\Users\Stage\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Stage\AppData\Local\Programs\Python\Python312\Lib\runpy.py", line 88, in run_code
exec(code, run_globals)
File "c:\Users\Stage.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy_main
.py", line 39, in <module>
cli.main()
File "c:\Users\Stage.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\Stage.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
runpy.run_path(target, run_name="main")
File "c:\Users\Stage.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy_vendored\pydevd_pydevd_bundle\pydevd_runpy.py", line 320, in run_path
code, fname = _get_code_from_file(run_name, path_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\Stage.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy_vendored\pydevd_pydevd_bundle\pydevd_runpy.py", line 294, in _get_code_from_file
code = compile(f.read(), fname, 'exec')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Stage\Desktop\DE-IT Projecten\main.py", line 9
await ctx.send(f'Hello, {ctx.author.name}!')
IndentationError: unexpected indent

cunning girder
#

yeah whatever ignore that

#

you can hit ctrl + k to clear the console

scarlet torrent
cunning girder
#

yeah stop running the debugger

#

you're just trying to install python right now

scarlet torrent
#

oh yea

#

and what do i do now?

scarlet torrent
#

i did

cunning girder
#

and it worked? it created a folder named venv?

scarlet torrent
#

yea

cunning girder
#

great, and vscode prompted you to select the inperpreter?

scarlet torrent
cunning girder
#

so in the bottom right it says Python 3.12.6?

scarlet torrent
#

now everything is marked in red

#

for sum reason

cunning girder
#

you shouldn't be messing with stuff in the venv/ directory

#

you can close that tab

#

but now your environment is setup properly and you can hit the debugger button

#

and you can share your code and stuff and people will help you, i gtg though

#

cya

cunning girder
scarlet torrent
flat stagBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, 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.