kitao / pyxel

A retro game engine for Python
MIT License
15.35k stars 847 forks source link

pyo3_runtime.PanicException: Unable to open file #477

Closed reacondicionad0 closed 1 year ago

reacondicionad0 commented 1 year ago

Hello, I was trying to run this: https://github.com/kris-classes/pyxel-snippets/blob/master/06_images.py

But this line fails: pyxel.image(0).load(0, 0, "assets/06_never.png")

This is the error: thread '' panicked at 'Unable to open file 'assets/06_never.png'', D:\a\pyxel\pyxel\crates\pyxel-core\src\image.rs:44:33 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace Traceback (most recent call last): File "c:\pyxel\pyxel-snippets-master\06_images.py", line 38, in App() File "c:\pyxel\pyxel-snippets-master\06_images.py", line 13, in init pyxel.image(0).load(0, 0, "assets/06_never.png") pyo3_runtime.PanicException: Unable to open file 'assets/06_never.png'

The png file exists and I can access from the editor (VS Code).

My specs: Python 3.11.0 pyxel 1.9.16 Windows 10

ありがとうございます。

:)

reacondicionad0 commented 1 year ago

After some more testing, it seems to be a problem with the picture itself. I tried with cat_16x16.png from Pyxel repository and it loads well.

It looks like these files are not valid for Pyxel: https://github.com/kris-classes/pyxel-snippets/blob/master/assets/06_never.png https://github.com/kris-classes/pyxel-snippets/blob/master/assets/07_colorkey.png

They have more than 16 different colors. I guess that is the problem. I am closing the issue.