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

Android build error with module chess - Module not found #27

Open
Scintsz opened this issue Dec 16, 2024 · 4 comments
Open

Android build error with module chess - Module not found #27

Scintsz opened this issue Dec 16, 2024 · 4 comments

Comments

@Scintsz
Copy link

Scintsz commented Dec 16, 2024

When trying to build an Android version, there is a library error related to the chess module inside "00-chess-engine/python-packages/chess/". The build finishes and installs on Android but fails upon running with the following message:

"""
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/00-chess-engine/chess_displayable.rpy", line 213, in
ModuleNotFoundError: No module named 'chess'

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "00-chess-engine/chess_displayable.rpyc", line 201, in script
File "renpy/ast.py", line 827, in execute
File "renpy/python.py", line 1178, in py_exec_bytecode
File "game/00-chess-engine/chess_displayable.rpy", line 213, in
ModuleNotFoundError: No module named 'chess'

"""

For some reason, the folder is read correctly. I already tried inserting "import chess" in the build.py and android.py, but it seems that this is not enough.

The mobile emulation on renpy launcher works fine.

@RuolinZheng08
Copy link
Owner

This is a known issue but unfortunately I don't have an Android device to debug this on and have only been using the renpy mobile emulator. I will circle back to this one if I can get my hands on an Android device.

@RuolinZheng08
Copy link
Owner

Briefly tested on a friend's phone. You will be able to import chess if you move the chess module (game/00-chess-engine/python-packages/chess) directly under game/. However, the next problem is the path of stockfish (the chess AI). Not even sure if stockfish can be loaded correctly without renpy.file on Android per renpy/renpy#1226.

@RuolinZheng08
Copy link
Owner

@Scintsz If you need a quick hacky way of making this work, try putting everything from 00-chess-engine/ directly into the base game/ directory and getting rid of any references to 00-chess-engine/ in the code. This way Android should be less confused about the chess package path and stockfish binary path.

@Scintsz
Copy link
Author

Scintsz commented Feb 10, 2025

@RuolinZheng08, sorry for the delay, thank you for your time, with your orientation, I removed any trace of the "00-chess-engine" folder, and adjusted the variables to the new location in /game, now the game open on the Android, but still there is a problem with Stockfish, the log is below. The file "stockfish-10-armv7" is in the equivelent folder on Linux, but perheaps I missed some step?

[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
File "game/xadrez_minigame.rpy", line 12, in
FileNotFoundError: [Errno 2] No such file or directory: '/data/user/0/com.domain.dani_adventures/files/game/bin/stockfish-10-armv7'

-- Full Traceback ------------------------------------------------------------

Full traceback:
File "xadrez_minigame.rpyc", line 12, in script
File "renpy/ast.py", line 827, in execute
File "renpy/python.py", line 1178, in py_exec_bytecode
File "game/xadrez_minigame.rpy", line 12, in
File "python-packages/chess/engine.py", line 2861, in popen_uci
File "python-packages/chess/engine.py", line 2853, in popen
File "python-packages/chess/engine.py", line 201, in run_in_background
File "lib/python3.9/concurrent/futures/_base.py", line 446, in result
File "lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
File "python-packages/chess/engine.py", line 195, in background
File "lib/python3.9/asyncio/runners.py", line 44, in run
File "lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
File "python-packages/chess/engine.py", line 2841, in background
File "python-packages/chess/engine.py", line 1239, in popen
File "lib/python3.9/asyncio/base_events.py", line 1661, in subprocess_exec
File "lib/python3.9/asyncio/unix_events.py", line 197, in _make_subprocess_transport
File "lib/python3.9/asyncio/base_subprocess.py", line 36, in init
File "lib/python3.9/asyncio/unix_events.py", line 789, in _start
File "lib/python3.9/subprocess.py", line 951, in init
File "lib/python3.9/subprocess.py", line 1821, in _execute_child
FileNotFoundError: [Errno 2] No such file or directory: '/data/user/0/com.domain.dani_adventures/files/game/bin/stockfish-10-armv7'

[/code]

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

No branches or pull requests

2 participants