#๐ what does this mean?
93 messages ยท Page 1 of 1 (latest)
@scarlet torrent
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.
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")
If you got rid of the import, it must be a different error, post the error
Did you save the file after you got rid of the import audioop line?
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")```
yeah
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
currently using 3.12.6
take a gander at the bottom right of your vscode
you'll find that it says python 3.13
that means it hasn't been released yet and isn't guaranteed to work correctly
and now you'll need to recreate your .venv using version 3.12.6
i.e. rmdir .venv; py -3.12 -m venv .venv
you put it in /DE-IT Projects/venv/
yep, that
Delete the entire venv folder.
done
then, you can create a python 3.12 environment in it's place by using the command py -3.12 -m venv venv
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
did you mess with the installation options in the python installer?
if not, just restart vscode and try again
Interesting. You installed Python on windows but don't have the py launcher that comes bundled with it.
if you did, you shouldn't have
click cancel
great, cancel
then, try this again
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.
now it gave me a error in my terminal
And this is after you restarted vscode?
after i debugged
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
everytime i debug it shows this
.
i did
and it worked? it created a folder named venv?
yea
great, and vscode prompted you to select the inperpreter?
so in the bottom right it says Python 3.12.6?
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
also you really have to do this, like immediately
i did
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.