Skip to content

Error when logging incorrect sized images #15

@PhasecoreX

Description

@PhasecoreX

Looks like an error is happening when it tries to log that an image wasn't the correct size:

INFO:root:Processing app ID 677620 : Splitgate
INFO:root:Extracting icon(s) from /home/phasecorex/.var/app/com.valvesoftware.Steam/.local/share/Steam/steam/games/6bed647ef2dd5e8673acd068fd5b9dc934eba9d6.ico
/home/phasecorex/.venv/steam-desktop-updater/venv/lib/python3.10/site-packages/PIL/IcoImagePlugin.py:316: UserWarning: Image was not the expected size
  warnings.warn("Image was not the expected size")
--- Logging error ---
Traceback (most recent call last):
  File "/usr/lib/python3.10/logging/__init__.py", line 1100, in emit
    msg = self.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 943, in format
    return fmt.format(record)
  File "/usr/lib/python3.10/logging/__init__.py", line 678, in format
    record.message = record.getMessage()
  File "/usr/lib/python3.10/logging/__init__.py", line 368, in getMessage
    msg = msg % self.args
TypeError: %i format: a real number is required, not tuple
Call stack:
  File "/home/phasecorex/.venv/steam-desktop-updater/program/steam_desktop_updater.py", line 293, in <module>
    create_desktop_data(steam_root=args.steam_root, destdir=args.datatir, steam_cmd=args.steam_command)
  File "/home/phasecorex/.venv/steam-desktop-updater/program/steam_desktop_updater.py", line 279, in create_desktop_data
    app.extract_icons(destdir)
  File "/home/phasecorex/.venv/steam-desktop-updater/program/steam_desktop_updater.py", line 116, in extract_icons
    icon_file.extract(destdir)
  File "/home/phasecorex/.venv/steam-desktop-updater/program/steam_desktop_updater.py", line 191, in extract
    logging.warning('Expected size %ix%i, got %ix%i', size, size, h, w)
Message: 'Expected size %ix%i, got %ix%i'
Arguments: ((256, 256), (256, 256), 512, 512)

The variable size isn't the integer 256, it's a tuple of (256, 256), which then breaks the logging formatter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions