У меня есть функция, которая делает снимок экрана с реального смартфона с Appium и Python:
def TakeScreenshotThumbnail(p_driver):
# now that we have the preliminary stuff out of the way time to get that image :D
try:
element = p_pic_element # find part of the page you want image of
location = element.location
size = element.size
img = p_driver.get_screenshot_as_png()
img = Image.open(BytesIO(img))
left = location['x']
top = location['y']
right = location['x'] + size['width']
bottom = location['y'] + size['height']
im = img.crop((left, top, right, bottom)) # defines crop points
print(f"im : {im}")
return im
Затем я вызываю эту функцию, чтобы сохранить изображение pil в переменной, и я проверяю, существует ли оно в моя mysql таблица:
picture=TakeScreenshotThumbnail(p_driver, field_gallery[n])
if not p_cursor1.execute(
"SELECT * FROM actions INNER JOIN pictures ON pictures.id = actions.id_picture WHERE pictures.picture=? and actions.id_social_account=? and actions.platform=?",
(picture, p_myprofile, 'instagram')).fetchone():
Я получаю этот вывод с сообщением об ошибке:
im: обратная связь (последний вызов был последним): файл "E: / DropboxBACKUP14112018 / Cff /Python/phonebot_GITHUB/test.py ", строка 261, в PublishPics (драйвер, master_account, '53519716736397') Файл" E: /DropboxBACKUP14112018/Cff/Python/phonebot_GITHUB/test.py ", строка 158, в PublishPics (изображение p_myprofile, 'instagram')). fetchone ():
sqlite3.InterfaceError: Ошибка привязки параметра 0 - возможно, неподдерживаемый тип.
Процесс завершен с кодом выхода 1
столбец 'picture' моей таблицы 'pictures' имеет тип BLOB.
Я не понимаю, что я делаю, выкручивая.