Answer the question
In order to leave comments, you need to log in
What is sqlite python error?
try:
img2 = open(f'{maxmark[2][0]}', 'rb')
mime = magic.Magic(mime=True)
filename = mime.from_file(maxmark[2])
if filename.find('image') != -1:
con = sqlite3.connect("database.db")
cursor = con.cursor()
cursor.execute(f'SELECT username FROM PHOTOSLOTS WHERE slots = "{maxmark[2]}"')
username = cursor.fetchone()
con.commit()
cursor.execute(f'SELECT namerank FROM users WHERE username = "{username[0]}"')
namerank = cursor.fetchone()
con.commit()
dataCopy = cursor.execute(f'SELECT count(slots) FROM PHOTOSLOTS WHERE username = "{username[0]}"')
values = dataCopy.fetchone()
con.commit()
cursor.execute(f'SELECT star FROM stars WHERE photo = "{maxmark[2]}" ')
mark = cursor.fetchone()
if namerank is not None:
bot.send_message(message.chat.id, f'┃➣ Автор - @{username[0]} \n'
f'┃➣ Количество обоев - {values[0]}\n'
f'┃➣ Уровень - {namerank[0]}\n', reply_markup=key_com)
else:
bot.send_message(message.chat.id, f'┃➣ Автор - @{username[0]} \n'
f'┃➣ Количество обоев - {values[0]}\n'
f'┃➣ Уровень - {namerank}\n', reply_markup=key_com)
bot.send_photo(message.chat.id, img2)
bot.send_message(message.chat.id, maxmark[0], reply_markup=marku)
elif filename.find('video') != -1:
con = sqlite3.connect("database.db")
cursor = con.cursor()
cursor.execute(f'SELECT username FROM PHOTOSLOTS WHERE slots = "{maxmark[2]}"')
username = cursor.fetchone()
con.commit()
cursor.execute(f'SELECT namerank FROM users WHERE username = "{username[0]}"')
namerank = cursor.fetchone()
con.commit()
dataCopy = cursor.execute(f'SELECT count(slots) FROM PHOTOSLOTS WHERE username = "{username[0]}"')
values = dataCopy.fetchone()
con.commit()
cursor.execute(f'SELECT star FROM stars WHERE photo = "{maxmark[2]}" ')
mark = cursor.fetchone()
if namerank is not None:
bot.send_message(message.chat.id, f'┃➣ Автор - @{username[0]} \n'
f'┃➣ Количество обоев - {values[0]}\n'
f'┃➣ Уровень - {namerank[0]}\n', reply_markup=key_com)
else:
bot.send_message(message.chat.id, f'┃➣ Автор - @{username[0]} \n'
f'┃➣ Количество обоев - {values[0]}\n'
f'┃➣ Уровень - {namerank}\n', reply_markup=key_com)
bot.send_video(message.chat.id, img2)
bot.send_message(message.chat.id, maxmark[2], reply_markup=marku)
except Exception as e:
print(e)
bot.send_message(message.chat.id, f'<b>『ТОП 3』 - </b>{maxmark[2][0]}', reply_markup=markup3, parse_mode='html')
Answer the question
In order to leave comments, you need to log in
img2 = open(f'{maxmark[2][0]}', 'rb')
mime = magic.Magic(mime=True)
filename = mime.from_file(maxmark[2])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question