Skip to content

PDF generation raises an index error during messages collection #167

@Leujii

Description

@Leujii

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions