#TypeError 'NoneType' object is not iterable

1 messages · Page 1 of 1 (latest)

solid pine
#

Thats not a codeblcok

manic kernel
warped sorrel
#

what are those colors 🤢

solid pine
#

?tag codeblock

obsidian hearthBOT
#

Please put your code in a code block:
```py
Here is your Code
```

That makes reading code in Discord a lot easier:

print("This is an example.")
junior cosmos
# solid pine ?tag codeblock
@bot.slash_command(name='warns', description='Просмотр варнов')
async def warn1(ctx, user: Option(discord.Member)):
    use = user.id
    
    warns = discord.Embed(title=f'Предупрежления {ctx.author}')
    for warn in b.get_warn(b, user):
        warns.add_field(name=f'№ {warn[0]}', value=f'Причина: `{warn[2]}`  Модератор: <@{warn[1]}>')  
junior cosmos
#

TypeError 'NoneType' object is not iterable

karmic valve
junior cosmos
#

i want to make warns list but when i get warns from database i've got error:

  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 127, in wrapped
    ret = await coro(arg)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/discord/commands/core.py", line 881, in _invoke
    await self.callback(ctx, **kwargs)
  File "/Volumes/Danya disk/coding/Py-cord/HFD/main.py", line 297, in warn1
    for warn in b.get_warn(b, user):
  File "/Volumes/Danya disk/coding/Py-cord/HFD/core/bd.py", line 65, in get_warn
    self.cr.execute("SELECT id, modid, reason FROM warns WHERE userid = ?",(user,))
sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.```

**code:**

```python
@bot.slash_command(name='warns', description='Просмотр варнов')
async def warn1(ctx, user: Option(discord.Member)):
    use = user.id
    
    warns = discord.Embed(title=f'Предупрежления {ctx.author}')
    for warn in b.get_warn(b, user):
        warns.add_field(name=f'№ {warn[0]}', value=f'Причина: `{warn[2]}`  Модератор: <@{warn[1]}>')  
def get_warn(self, user):
        self.cr.execute("SELECT id, modid, reason FROM warns WHERE userid = ?",(user,))```
solid pine
#

try using this-
for warn in b.get_warn(use):

#

you were passing user object itself rather than the user's id

#

also, try learning a bit more about oop

you were passing in b as a parameter. but that will be done automatically as you doing b.get_warn

junior cosmos
#

thanks

junior cosmos
solid pine
#

hmm dk. wait for someone else

inland moss
#

@junior cosmos yo

#

Mind if we vc

#

?

junior cosmos
#

Please

inland moss
#

I can however its a bit hard to explain

#

So you do know

#

Sqlite returns a tuple value

#

Plus I am playing apex so typing is hard

junior cosmos
junior cosmos
inland moss
#

Okay

#

@junior cosmos
Can u share ur code in a code block

junior cosmos