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

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

Open
marinelay opened this issue Apr 11, 2024 · 0 comments · May be fixed by #8684
Open

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

marinelay opened this issue Apr 11, 2024 · 0 comments · May be fixed by #8684

Comments

@marinelay
Copy link
Contributor

Software Versions

  • Python: 3.9.18
  • OS: Ubuntu 22.04
  • Kivy: 2.3.0
  • Kivy installation method: pip install

Describe the bug

with open(self.tex_fn, 'wb') as fd:
fd.write('KTEX')
fd.write(pack('I', len(header)))
fd.write(header)
fd.write(data)

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

with open(self.tex_fn, 'wb') as fd:
fd.write('KTEX')
fd.write(pack('I', len(header)))
fd.write(header)
fd.write(data)

@marinelay marinelay linked a pull request Apr 17, 2024 that will close this issue
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant