Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF generation raises an index error during messages collection #167

Open
Leujii opened this issue Aug 22, 2023 · 0 comments
Open

PDF generation raises an index error during messages collection #167

Leujii opened this issue Aug 22, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@Leujii
Copy link

Leujii commented Aug 22, 2023

Description
While running !pdf after a game, the process is stopped while raising an error during message collection. Sometimes it does not happen.

Here is the full transcript of the error on the machine end :

ERROR    discord.client Ignoring exception in on_command_error
Traceback (most recent call last):
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 229, in wrapped
   ret = await coro(args, **kwargs)
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/src/cogs/export.py", line 500, in pdf
   pdf.output(str(out))
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 1065, in output
   self.close()
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 246, in close
   self._enddoc()
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 1637, in _enddoc
   self._putresources()
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 1584, in _putresources
   self._putfonts()
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 1315, in _putfonts
   self._putTTfontwidths(font, ttf.maxUni)
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/fpdf/fpdf.py", line 1448, in _putTTfontwidths
   if (font['cw'][cid] == 0):
IndexError: list index out of range

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

Traceback (most recent call last):
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/discord/client.py", line 441, in _run_event
   await coro(args, **kwargs)
File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/src/main.py", line 204, in on_command_error
   raise error
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/discord/ext/commands/bot.py", line 1350, in invoke
   await ctx.command.invoke(ctx)
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 1023, in invoke
   await injected(*ctx.args, **ctx.kwargs)  # type: ignore
 File "/home/pi/alice_is_missing/White-Rabbit-0.15.0/venv/lib/python3.10/site-packages/discord/ext/commands/core.py", line 238, in wrapped
   raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: IndexError: list index out of range

Reproducing
Steps to reproduce the behavior:
Generate the PDF after having a game. (played in french). It happens about 2 out of 3 times.

Expected behavior
The PDF is generated without errors, and can be uploaded after. No PDF can be found on the machine

System Info
OS: Raspberry Pi 4 on Bullseye 11
Python version: 3.10
Bot version: 0.15.0

Other details

@Leujii Leujii added the bug Something isn't working label Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant