Reputation: 183
I love using python orm peewee, but I getting this error again and again.
"InterfaceError: Error binding parameter 0 - probably unsupported type"
The most frustrating thing is that it does not shows always. It appears to act arbitrarily.
The code that causes the error is quite simple and as I said, sometimes works sometimes does not.
lista=Tareas.select().where((Tareas.ta_usuario==self.user.id) & (Tareas.done=="True"))
for tarea in lista:
borrada=tarea.delete_instance()
Any clue about what can be causing the error?
The difinition of tareas is simple:
class Tareas(SqliteModel):
task = CharField()
done = CharField()
ta_usuario = IntegerField()
Upvotes: 1
Views: 1190
Reputation: 5942
This is issue #81. The problem is that you are modifying the data while consuming the loop.
Try this:
lista = Tareas.select().where(
(Tareas.ta_usuario==self.user.id) & (Tareas.done=="True")
)
lista_de_tareas = [i for i in lista]
for tarea in lista_de_tareas:
borrada = tarea.delete_instance()
See the response to the GitHub issue for other solutions.
Upvotes: 1