Closed albertoxamin closed 3 years ago
@albertoxamin sorry, for some reasons I haven't received any notification from GitHub about this issue.
I've just now updated the bot with a few bugfixes. Can you update your bot and try to create a pack now?
Just checked the logs and apparently I get a similar error too:
[2019-11-20 22:30:21,424][bot.handlers.stickers.topng][topng:on_sticker_receive:19][INFO] >>> user sent a stciker to convert
[2019-11-20 22:30:21,425][bot.sticker.stickers][stickers:__init__:40][DEBUG] >>> StickerFile object is a Sticker
[2019-11-20 22:30:21,427][bot.sticker.stickers][stickers:download:82][DEBUG] >>> downloading sticker
[2019-11-20 22:30:21,446][bot.sticker.stickers][stickers:download:85][DEBUG] >>> downloading to bytes object: self._tempfile_downloaded
[2019-11-20 22:30:21,455][bot.sticker.stickers][stickers:prepare_png:93][INFO] >>> preparing png
[2019-11-20 22:30:21,457][bot.utils.helpers.decorators][decorators:wrapped:35][ERROR] >>> error while running handler callback: cannot identify image file <tempfile.SpooledTemporaryFile object at 0x7f1694089b38>
Traceback (most recent call last):
File "/root/sticker-thief/bot/utils/helpers/decorators.py", line 33, in wrapped
return func(update, context, *args, **kwargs)
File "/root/sticker-thief/bot/handlers/stickers/topng.py", line 22, in on_sticker_receive
sticker.download(prepare_png=True)
File "/root/sticker-thief/bot/sticker/stickers.py", line 90, in download
return self.prepare_png()
File "/root/sticker-thief/bot/sticker/stickers.py", line 95, in prepare_png
im = Image.open(self._tempfile_downloaded) # try to open bytes object
File "/root/sticker-thief/venv/lib/python3.5/site-packages/PIL/Image.py", line 2818, in open
raise IOError("cannot identify image file %r" % (filename if filename else fp))
OSError: cannot identify image file <tempfile.SpooledTemporaryFile object at 0x7f1694089b38>
A good thing to do would be catching what stickers/pngs are causing this problem, because it only happens with some stickers.
This probably is an issue with what happens between downloading the webp from Telegram and converting it to png. PIL is likely receiving an already corrupted file
Since 4cfd03a, the bot doesn't do the png conversion anymore. I've just checked the error logs from the past 6 months and there is no trace of that error. I will close the issue in the upcoming months if nobody reports such OSError
again
Sorry for the late response, I just checked and it is working now thanks!