AznStevy / Maybe-Useful-Cogs

Random cogs for a discord bot.
MIT License
29 stars 31 forks source link

leveler, anything to do with images broke #44

Open GGrandma opened 6 years ago

GGrandma commented 6 years ago

I have looked into this for a while trying to see if it is on my side, I belive this is not because of me. Here is a log when I try to do [p]profile

Exception in command 'profile' Traceback (most recent call last): File "lib/discord/ext/commands/core.py", line 50, in wrapped ret = yield from coro(*args, **kwargs) File "/home/pi/Desktop/PeaterBot/cogs/leveler.py", line 105, in profile await self.draw_profile(user, server) File "/home/pi/Desktop/PeaterBot/cogs/leveler.py", line 1987, in draw_profile profile_image = Image.open('data/leveler/temp/{}_temp_profile_profile.png'.format(user.id)).convert('RGBA') File "lib/PIL/Image.py", line 2572, in open % (filename if filename else fp)) OSError: cannot identify image file 'data/leveler/temp/208696987082555393_temp_profile_profile.png'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "lib/discord/ext/commands/bot.py", line 846, in process_commands yield from command.invoke(ctx) File "lib/discord/ext/commands/core.py", line 374, in invoke yield from injected(*ctx.args, **ctx.kwargs) File "lib/discord/ext/commands/core.py", line 54, in wrapped raise CommandInvokeError(e) from e discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OSError: cannot identify image file 'data/leveler/temp/208696987082555393_temp_profile_profile.png'

Pierce01 commented 6 years ago

give this a shot. I havent tested it, but yeah

https://stackoverflow.com/questions/19230991/image-open-cannot-identify-image-file-python

AznStevy commented 6 years ago

If you're on windows, it has to do with that, I think.

GGrandma commented 6 years ago

Haven't tried what Pierce said yet but I am running my bot off a Raspberry Pi 3 with Python 3.

GGrandma commented 6 years ago

Sorry for the long long long wait, this did not fix it. The error im getting now is.

Exception in command 'profile' Traceback (most recent call last): File "lib/discord/ext/commands/core.py", line 50, in wrapped ret = yield from coro(*args, **kwargs) File "/home/pi/Desktop/PeaterBot/cogs/leveler.py", line 107, in profile await self.draw_profile(user, server) File "/home/pi/Desktop/PeaterBot/cogs/leveler.py", line 1988, in draw_profile bg_image = Image.open('data/leveler/temp/{}_temp_profile_bg.png'.format(user.id)).convert('RGBA') File "lib/PIL/Image.py", line 875, in convert self.load() File "lib/PIL/ImageFile.py", line 255, in load raise_ioerror(err_code) File "lib/PIL/ImageFile.py", line 59, in raise_ioerror raise IOError(message + " when reading image file") OSError: broken data stream when reading image file

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "lib/discord/ext/commands/bot.py", line 846, in process_commands yield from command.invoke(ctx) File "lib/discord/ext/commands/core.py", line 374, in invoke yield from injected(*ctx.args, **ctx.kwargs) File "lib/discord/ext/commands/core.py", line 54, in wrapped raise CommandInvokeError(e) from e discord.ext.commands.errors.CommandInvokeError: Command raised an exception: OSError: broken data stream when reading image file

^ broken when reading image D:

vico93 commented 6 years ago

I'm having similar issues.

May 13 22:52:15 HEFESTO python3.5[702]: [13/05/2018 22:52] ERROR red on_command_error 369: Exception in command 'rank'
May 13 22:52:15 HEFESTO python3.5[702]: Traceback (most recent call last):
May 13 22:52:15 HEFESTO python3.5[702]:   File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 50, in wrapped
May 13 22:52:15 HEFESTO python3.5[702]:     ret = yield from coro(*args, **kwargs)
May 13 22:52:15 HEFESTO python3.5[702]:   File "/mnt/usb0/.discord_bots/red/cogs/leveler.py", line 168, in rank
May 13 22:52:15 HEFESTO python3.5[702]:     await self.draw_rank(user, server)
May 13 22:52:15 HEFESTO python3.5[702]:   File "/mnt/usb0/.discord_bots/red/cogs/leveler.py", line 2584, in draw_rank
May 13 22:52:15 HEFESTO python3.5[702]:     profile_image = Image.open('data/leveler/temp/test_temp_rank_profile.png'.format(user.id)).convert('RGBA')
May 13 22:52:15 HEFESTO python3.5[702]:   File "lib/PIL/Image.py", line 2590, in open
May 13 22:52:15 HEFESTO python3.5[702]:     % (filename if filename else fp))
May 13 22:52:15 HEFESTO python3.5[702]: OSError: cannot identify image file 'data/leveler/temp/test_temp_rank_profile.png'
May 13 22:52:46 HEFESTO python3.5[702]: 19
May 13 22:53:39 HEFESTO python3.5[702]: 15
May 13 22:54:46 HEFESTO python3.5[702]: [13/05/2018 22:54] ERROR red on_command_error 369: Exception in command 'profile'
May 13 22:54:46 HEFESTO python3.5[702]: Traceback (most recent call last):
May 13 22:54:46 HEFESTO python3.5[702]:   File "/usr/local/lib/python3.5/dist-packages/discord/ext/commands/core.py", line 50, in wrapped
May 13 22:54:46 HEFESTO python3.5[702]:     ret = yield from coro(*args, **kwargs)
May 13 22:54:46 HEFESTO python3.5[702]:   File "/mnt/usb0/.discord_bots/red/cogs/leveler.py", line 103, in profile
May 13 22:54:46 HEFESTO python3.5[702]:     await self.draw_profile(user, server)
May 13 22:54:46 HEFESTO python3.5[702]:   File "/mnt/usb0/.discord_bots/red/cogs/leveler.py", line 2021, in draw_profile
May 13 22:54:46 HEFESTO python3.5[702]:     profile_image = Image.open('data/leveler/temp/{}_temp_profile_profile.png'.format(user.id)).convert('RGBA')
May 13 22:54:46 HEFESTO python3.5[702]:   File "lib/PIL/Image.py", line 2590, in open
May 13 22:54:46 HEFESTO python3.5[702]:     % (filename if filename else fp))
May 13 22:54:46 HEFESTO python3.5[702]: OSError: cannot identify image file 'data/leveler/temp/183671375695839233_temp_profile_profile.png'

And i'm also running red on a pi (3B)