#๐ agent Q
121 messages ยท Page 1 of 1 (latest)
@honest sable
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.
Are you on python 3.13?
Use 3.12 for now; discord.py uses audioop which was removed in 3.13
In this terminal, type ls and hit enter and show us the output
its in another test folder
So basically if you run py test/test.py that should work
But as code golfing enthusiast says, you need the audioop to work
a;r
Updating discord.py or installing audioop-lts should fix this.
how do i do either
pip install audioop-lts
I would py -m pip just to be safe
in cmd?
are you in a virtual env?
not clue what that is
!virtualenv
Virtual environments are isolated Python environments, which make it easier to keep your system clean and manage dependencies. By default, when activated, only libraries and scripts installed in the virtual environment are accessible, preventing cross-project dependency conflicts, and allowing easy isolation of requirements.
To create a new virtual environment, you can use the standard library venv module: python3 -m venv .venv (replace python3 with python or py on Windows)
Then, to activate the new virtual environment:
Windows (PowerShell): .venv\Scripts\Activate.ps1
or (Command Prompt): .venv\Scripts\activate.bat
MacOS / Linux (Bash): source .venv/bin/activate
Packages can then be installed to the virtual environment using pip, as normal.
For more information, take a read of the documentation. If you run code through your editor, check its documentation on how to make it use your virtual environment. For example, see the VSCode or PyCharm docs.
Tools such as poetry and pipenv can manage the creation of virtual environments as well as project dependencies, making packaging and installing your project easier.
Note: When using PowerShell in Windows, you may need to change the execution policy first. This is only required once per user:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
py -m pip install -U discord.py is the full command to update d.py
not realy sure
make one
Doesn't seem like it from the screenshots
First, set up a virtual env.
Second, either upgrade your discord.py or install audioop-lts in your virtual env
ok how to i set up virtual env
Read this โ๏ธ
(is it really necessary to use a venv?)
Its best practice to do so
and how do i upgrade my discord py or install audi loop?
Which one do you want to do? Upgrade discord.py or install audioop-lts?
upgrade discord?
im not really sure
โ๏ธ
do best practices matter for beginners who won't know why it is best practice?
Its been explained here, isn't it? Hopefully OP understood it โ๏ธ
did not. im like a grandma when it comes to this stuff
I wouldn't expect the average beginner to fully understand the tbh, partially because it could be better written
Fair
its still giving me the same error about cant open file no such file or directory
its in your test folder
idk what that means
i know that the file exists
but the app doesnt think it does
are you still doing python3?
yep
python3 test/test.py
you didn't install/upgrade discord.py
rerun the install upgrade command
I ran that one code in my cmd
twice
you're not in your virtualenv?
no
idk what virtualenv is or how to install it
Do you want to use a virtualenv or do you just want your bot to run?
you can't want to use something that you have no idea what it is
yeah im ngl idk what virtualenv is or what it does
a beginner does not have the ability to understand that, Agent Q
reading this doesnt mean anything to me
again, im like a toddler to this stuff
Then can't really help if you don't ask

OK forget the virtual env stuff
Is there a requirements.txt file in your files?
not in my test folder
where is it?
in another folder called dcrd test bot
Not Dcrd bot test?
python3 -m pip install -r requirements.txt
in cmd?
yes
Not in that cmd. The one in VSCode
Close this so you dont get confused
gotchu
Can you show me your files?
You said the requirements.txt file is in that folder. But the terminal says its not there.
i did?
Show me
ohh i thought you were asking where the testr folder is
i was saying it was in the dscrd folder
Is discord.py and audioop all you need to install?
Can you share your test.py file code in a pastebin?
i think i did discord.py not audioop tho
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
import discord
from discord.ext import commands
client = commands.bot(command_prefix = '!')
@client.event
async def on_ready():
print ("The bot is now ready for use")
print ("------------------------------")
@client.command()
async def hello (ctx):
await ctx.send ("Hello, hi!")
client.run('insert bot token')
Well the last error says you didn't install discord.py. Run this
python3 -m pip install -U discord.py audioop-lts
And you have 3.12 installed... fantastic
You have 2 different Python versions installed
And this could have been avoided if you have a virtualenv installed
Just do these commands:
python3 -m pip install -U discord.py
python3 test/test.py
I followed a tutorial to write the little bit of code
The tutorial should mention or show that its Bot. not bot. Big B. Not small b.
Here's a better tutorial IMO https://fallendeity.github.io/discord.py-masterclass/creating-a-bot/#__tabbed_5_2
A hands-on guide to Discord.py
best of luck!
dawg
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.