kitao / pyxel

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

Not importing local module with launcher #570

Closed helpcomputer closed 1 month ago

helpcomputer commented 1 month ago

I'm not sure what the issue is here but when I try to run:

https://kitao.github.io/pyxel/wasm/launcher/?run=helpcomputer.bubbles.src.main&gamepad=enabled

which is launching this repository file: https://github.com/helpcomputer/bubbles/blob/main/src/main.py

it gives me the following error:

Traceback (most recent call last):
  File "/lib/python312.zip/_pyodide/_base.py", line 522, in eval_code
    .run(globals, locals)
     ^^^^^^^^^^^^^^^^^^^^
  File "/lib/python312.zip/_pyodide/_base.py", line 356, in run
    coroutine = eval(self.code, globals, locals)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "", line 3, in 
  File "/lib/python3.12/site-packages/pyxel/cli.py", line 219, in run_python_script
    runpy.run_path(python_script_file, run_name="__main__")
  File "", line 286, in run_path
  File "", line 98, in _run_module_code
  File "", line 88, in _run_code
  File "main.py", line 4, in 
    from constants import APP_WIDTH, APP_HEIGHT, MAX_STAGE_NUMBER
ModuleNotFoundError: No module named 'constants'

I feel like it might be something simple I'm doing wrong, but this game works fine from the generated html version, as per this link: https://helpcomputer.github.io/pyxel/bubbles/

helpcomputer commented 1 month ago

Closing this as already raised here: https://github.com/kitao/pyxel/issues/509