pyxel icon indicating copy to clipboard operation
pyxel copied to clipboard

pyxel.load error when running pyxel web

Open Ninjdai1 opened this issue 1 year ago • 7 comments

Hi, I'm getting an error when trying to load pyxel web : when loading either pyxel-play or pyxel-editor, I get these messages :

Player output :

Traceback (most recent call last):
  File "/lib/python3.10/_pyodide/_base.py", line 460, in eval_code
    .run(globals, locals)
  File "/lib/python3.10/_pyodide/_base.py", line 306, in run
    coroutine = eval(self.code, globals, locals)
  File "", line 3, in 
  File "/lib/python3.10/site-packages/pyxel/cli.py", line 166, in run_python_script
    runpy.run_path(python_script_file, run_name="__main__")
  File "/lib/python3.10/runpy.py", line 269, in run_path
    return _run_module_code(code, init_globals, run_name,
  File "/lib/python3.10/runpy.py", line 96, in _run_module_code
    _run_code(code, mod_globals, init_globals,
  File "/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "app.py", line 230, in 
    App(216038)
  File "app.py", line 208, in __init__
    pyxel.load("./res.pyxres", True, True, False, False)
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }

Editor output :

Traceback (most recent call last):
  File "/lib/python3.10/_pyodide/_base.py", line 460, in eval_code
    .run(globals, locals)
  File "/lib/python3.10/_pyodide/_base.py", line 306, in run
    coroutine = eval(self.code, globals, locals)
  File "", line 3, in 
  File "/lib/python3.10/site-packages/pyxel/cli.py", line 221, in edit_pyxel_resource
    pyxel.editor.App(pyxel_resource_file, starting_editor)
  File "/lib/python3.10/site-packages/pyxel/editor/app.py", line 46, in __init__
    pyxel.load(resource_file)
pyo3_runtime.PanicException: called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }

Here is the page I'm trying to load (player.php):

<!DOCTYPE html>
<html>
    <head>
        <title>Billy: Story Mode</title>
        <script src="https://cdn.jsdelivr.net/gh/kitao/pyxel/wasm/pyxel.js"></script>
        <meta charset="UTF-8"/>
        <meta name="viewport" content="width=device-width, initial-scale=1">
    </head>
    <body>
        <pyxel-run root="./app" name="app.py"></pyxel-run>
    </body>
</html>

When loading a script that doesn't use pyxel.load, it works fine. I'm hosting the pages I'm trying to load on a GNU/Linux machine (debian Bullseye) with an nginx server. However, I don't get this error when running the same exact website on a windows machine with Apache :/

Any idea on why this is happening / how to fix this ? And yes, I already checked whether the client had access to the res.pyxres file, and it does

EDIT: Just noticed #462 , would it resolve the issue ?

Ninjdai1 avatar Apr 26 '23 12:04 Ninjdai1

It seems like an error that occurs when opening Pyxel 2.x resource files in Pyxel 1.9.

kitao avatar Jan 12 '24 08:01 kitao

It's an error that occured in Pyxel 1.9.14. I don't know if this still happens

Ninjdai1 avatar Jan 12 '24 08:01 Ninjdai1

I believe it was likely a lag due to the CDN updating after a Pyxel version upgrade. Usually, this takes about 8 hours. I think it should not occur anymore.

kitao avatar Jan 12 '24 09:01 kitao

I believe it's up to date and still happening ? It's an almost 1 year-old bug, and it still happened multiple days after the update... See https://ninjdai.ynh.fr/~/billy_storymode/player.php

Ninjdai1 avatar Jan 12 '24 14:01 Ninjdai1

I'm not sure. Because I dont't know which version of Pyxel is used to make the used resource file. First of all, does the resource file works on the native Pyxel, not on Web?

We need to determine whether the problem is due to the Web or some other factor.

kitao avatar Jan 12 '24 14:01 kitao

It did work on native pyxel, but again this is a year-old issue that may be already resolved/caused by a wrong version of pyxel on my end. I'll do some testing and post here my results

Ninjdai1 avatar Jan 12 '24 14:01 Ninjdai1

I'd like to know your app works with the latest Pyxel on Native environment because Web version of Pyxel always uses the latest Pyxel. Does it work?

kitao avatar Jan 12 '24 14:01 kitao

Let me close this issue since there's no reports on the latest Pyxel.

kitao avatar May 11 '24 01:05 kitao