cur = conn.cursor()
if callback_data.action == "next":
cur.execute("SELECT id FROM aromki")
page = page_num + 1 if page_num < (len(cur.fetchall())) else page_num
cur = conn.cursor()
cur.execute("SELECT * FROM aromki WHERE id = '{}'".format(page+1))
if cur.fetchone() is None:
page += 1
return
else:
print("Suc")
for d in cur.fetchall():
pass
await call.message.edit_media(InputMediaPhoto(media=d['photo'], caption=smiles[page][1]),reply_markup=kb.paginator(url=d['url'], page=page))
await call.answer()
Вотакая ошибка: cannot access local variable 'd' where it is not associated with a value
d
происходит вне контекста (вне цикла for d in cur.fetchall()
).for d in cur.fetchall():
await call.message.edit_media(InputMediaPhoto(media=d['photo'], caption=smiles[page][1]), reply_markup=kb.paginator(url=d['url'], page=page))