After reading this post Using git from a program i’ve tried different settings to get the path working with environment key word with no luck, still got an error :
ImportError: could not find any library for SDL2 (PYSDL2_DLL_PATH: :/snap/tauon/x2/usr/lib/x86_64-linux-gnu)
For now, i’m setting PYSDL2_DLL_PATH: $PYSDL2_DLL_PATH:$SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET in environment since that’s where i can see the lib reside in prime directory.
I’ve tried with PYSDL2_DLL_PATH: $PYSDL2_DLL_PATH:$SNAP/lib/python3.6/site-packages/sdl2 which fails too, and with PYTHONPATH: $PYTHONPATH:$SNAP/lib/python3.6/site-packages with no more luck :\
i literally meant searching for sdlmixer.py or something equivalent like “dll.py” from the above file list.
libSDL2 is irrelevant for the issue you are hitting (it is indeed needed for the backend support but your app is complaining about pysdl2 not about libsdl2 itself)
Sorry but i’m a bit lost, since the error was RuntimeError: could not find any library for SDL2 i was thinking the problem was the lib path.
I’ve tried to follow you advice and setting this PYTHONPATH: $PYTHONPATH:$SNAP/lib/python3.6/site-packages/sdl2 in environment, which led me to a new error :\
Traceback (most recent call last):
File "/snap/tauon/x8/tauon.py", line 341, in <module>
import platform
File "/snap/tauon/x8/lib/python3.6/site-packages/sdl2/platform.py", line 2, in <module>
from .dll import _bind
ImportError: attempted relative import with no known parent package
I can go further if i set PYSDL2_DLL_PATH: $SNAP/usr/lib/$SNAPCRAFT_ARCH_TRIPLET in snap yaml + patching pattern here https://github.com/marcusva/py-sdl2/blob/master/sdl2/dll.py#L19 as pattern = "lib%s.so.0" since the lib files are suffixed by 0 in prime folder => it works
To conclude, there is a bug with ctypes.util.find_library and another bug with pysdl2 that prevent it to correctly load .so* files, i’ve opened an issue for this one https://github.com/marcusva/py-sdl2/issues/148