#๐ TypeError: __init__() takes 4 positional arguments but 5 were given
113 messages ยท Page 1 of 1 (latest)
@ionic ingot
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.
?pastebin
2024-08-31 20:28:11 INFO discord.client logging in using static token
2024-08-31 20:28:13 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 1ebb790c1e6112bab81f095286a88da9).
Commands have been re-synced.
We have logged in
2024-08-31 20:28:52 ERROR discord.ui.view Ignoring exception in view <ApprovalView timeout=180.0 children=2> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Reject' emoji=None row=None sku_id=None>
Traceback (most recent call last):
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/ui/view.py", line 430, in _scheduled_task
await item.callback(interaction)
File "/Users/calvinsupasanya/Desktop/Coding/Project/YUGEN Accountant/main.py", line 862, in reject
modal = RejectionReasonModal(self.db, self.order, self.transaction, interaction.user.id)
TypeError: __init__() takes 4 positional arguments but 5 were given
that's the error code
and this is the /paid command section
and I honestly don't know anymore
I don't see what's wrong man
the error doesn't make sense with that code, no
in particular that error you would have for a class whose init took self + 3 args
what do you mean by that?

seems like you must be calling something other than that class definition in the code you shared
I didn't even provide 5 arguements in the modal variable
it was four
what is it complaining about
wdym by that
my only guess is that you re-define RejectionReasonModal somewhere later, from this code this error doesnt really make sense
What if you tried this?
modal = RejectionReasonModal(db=self.db, order=self.order, transaction=self.transaction, user_id=interaction.user.id)
how would that help thoughhhhh
... so its specific?
ok hold on
yes
but I'm just gonna replace my bot token
just a recommendation for this you can use certian things like config and dotenv so that you dont have to worry about private information when sharing code

ok so I tried this
2024-08-31 21:11:04 ERROR discord.ui.view Ignoring exception in view <ApprovalView timeout=180.0 children=2> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Reject' emoji=None row=None sku_id=None>
Traceback (most recent call last):
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/ui/view.py", line 430, in _scheduled_task
await item.callback(interaction)
File "/Users/calvinsupasanya/Desktop/Coding/Project/YUGEN Accountant/main.py", line 863, in reject
modal = RejectionReasonModal(
TypeError: __init__() got an unexpected keyword argument 'transaction'
!paste
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.
here's the new section of the code btw
ok so this error is clearer. Its saying that the RejectReasonModal, doesn't have transaction keyword param
like it recognizes, db and order but errors at transaction
this is still not the full code. i dont think Modal.__init_subclass__ does anything too weird so im still left with my only guess
?
ok
Are you sure you do not have another class called RejectReasonModal before the paid command?
I am sure
and I'm gonna send the full script
just let me try fixing that error first
and if we really can't
I'll send the full script
wraning though
it's more than a thousand fivehundred lines
Well, we aren't going to read all thousand and fivehundred lines, but we can trace where the problem is easier when we can see the full picture.
I can't paste the full script bruh
"thousand fivehundred" is 1500, how do you have 1500 lines take more than 512 kb? do you have lines larger than 350 chars each? that doesnt make sense
Create multiple pastes. Half in one, half in the other.

if this is relying on some hot-reloading of code maybe something isn't being reloaded correctly
uhhhh sooo
this is the ORIGINAL version of the /paid section of the code
2024-08-31 21:27:50 INFO discord.client logging in using static token
2024-08-31 21:27:52 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: a36711715662091d7eb3a03d79e57c54).
Commands have been re-synced.
We have logged in
2024-08-31 21:28:46 ERROR discord.ui.view Ignoring exception in view <ApprovalView timeout=180.0 children=2> for item <Button style=<ButtonStyle.danger: 4> url=None disabled=False label='Reject' emoji=None row=None sku_id=None>
Traceback (most recent call last):
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/ui/view.py", line 430, in _scheduled_task
await item.callback(interaction)
File "/Users/calvinsupasanya/Desktop/Coding/Project/YUGEN Accountant/main.py", line 862, in reject
modal = RejectionReasonModal(self.db, self.order, self.transaction, interaction.user.id, self.original_channel_id)
TypeError: __init__() takes 4 positional arguments but 6 were given
and this is the error message
Need the rest of the code... Not sure if you can upload it to Github or something and share?
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.
you redefine RejectionReasonModal on line 1084
^
Why do you have another class of the same name at line 1084?
not exactly surprised, if you wrote this by yourself you'd find this error right away
And that is why it's important to share all yourgpt code, not just what you think is important.
WIAT WHAT SHOULD I DO
I"M SORRY GUYS
FOORGIVE ME
thank u for emphasizing
brother
Maybe delete that class in line 1084?
You only need one unique class that should be handled in both situations
or can I rename the other class on 1084?
sure
@opaque folio
I
yo
@opaque folio @sinful kelp lambda and agent
I will virtually send u my dearest and sincerest thanks
to you
god bless
you
I love you
let me kiss u
@opaque folio
@opaque folio
2024-08-31 21:50:41 INFO discord.client logging in using static token
2024-08-31 21:50:43 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: 9524971538d541dd0483a6c271cfeb9b).
Commands have been re-synced.
We have logged in
2024-08-31 21:51:46 ERROR discord.ui.modal Ignoring exception in modal <RejectionReasonModal timeout=None children=1>:
Traceback (most recent call last):
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/ui/modal.py", line 189, in _scheduled_task
await self.on_submit(interaction)
File "/Users/calvinsupasanya/Desktop/Coding/Project/YUGEN Accountant/main.py", line 915, in on_submit
await interaction.response.edit_message(embed=embed, view=self.disable_buttons())
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/interactions.py", line 990, in edit_message
await adapter.create_interaction_response(
File "/Users/calvinsupasanya/Library/Python/3.9/lib/python/site-packages/discord/webhook/async_.py", line 223, in request
raise HTTPException(response, data)
discord.errors.HTTPException: 400 Bad Request (error code: 50035): Invalid Form Body
In data.components.0.components.0: Value of field "type" must be one of (2, 3, 5, 6, 7, 8).
WE GOT ANOTHER ISSUE
!paste
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.
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.