kivy / kivy

Open source UI framework written in Python, running on Windows, Linux, macOS, Android and iOS
https://kivy.org
MIT License
17k stars 3.04k forks source link

`Tool.write_tex` raises a type error by invalid write #8676

Open marinelay opened 1 month ago

marinelay commented 1 month ago

Software Versions

Describe the bug

https://github.com/kivy/kivy/blob/c0d4894384abb81cf4729984a1eaa4c437d266da/kivy/tools/texturecompress.py#L81-L85

This is the same issue as #8675 (at line 82). I suppose that it is correct to change from str to bytes, or vice versa.

If you like, I can send PR for both this issue and #8675. Thank you.

To Reproduce

from kivy.tools.texturecompress import Tool
from argparse import ArgumentParser

parser = ArgumentParser(
        description='Convert images to compressed texture')
parser.add_argument('--dir', type=str, default=None,
        help='Output directory to generate the compressed texture')
parser.add_argument('format', type=str, choices=['pvrtc', 'etc1'],
        help='Format of the final texture')
parser.add_argument('image', type=str,
        help='Image filename')
args = parser.parse_args()

a = Tool(args).write_tex([], args.format, (1, 1), (1, 1))

Code and Logs and screenshots

https://github.com/kivy/kivy/blob/c0d4894384abb81cf4729984a1eaa4c437d266da/kivy/tools/texturecompress.py#L81-L85