cosmologicon / pygame-text

Convenience functions for drawing using the pygame.font module.
Other
84 stars 12 forks source link

ImportError: libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory #7

Closed TheConceptBoy closed 3 years ago

TheConceptBoy commented 3 years ago

pygame 2.0.0.dev10 (SDL 2.0.9, python 3.7.3) Hello from the pygame community. https://www.pygame.org/contribute.html /home/pi/Documents/lonesome_trail_py/ptext.py:44: RuntimeWarning: use font: libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory (ImportError: libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory) pygame.font.init() Traceback (most recent call last): File "lt.py", line 11, in <module> import ptext File "/home/pi/Documents/lonesome_trail_py/ptext.py", line 44, in <module> pygame.font.init() File "/home/pi/.local/lib/python3.7/site-packages/pygame/__init__.py", line 59, in __getattr__ raise NotImplementedError(missing_msg) NotImplementedError: font module not available (ImportError: libSDL2_ttf-2.0.so.0: cannot open shared object file: No such file or directory)

This is on the latest PyGame as of this post - pygame 2.0.0.dev10

If I rollback to pygame 1.9.4.post1, it works fine. But I need 2.0.0 to set custom audio output.

cosmologicon commented 3 years ago

It looks like there's a problem with your pygame installation. Are you able to use the pygame.font module without ptext? For instance, does this work?

>>> pygame.font.init()
>>> pygame.font.Font()
>>> font = pygame.font.Font(None, 20)

If it doesn't work, I'm afraid I haven't seen that error before, but I'm sure the pygame community will be able to help you! You can find out how to ask for help at https://www.pygame.org/wiki/info

TheConceptBoy commented 3 years ago

I had ended up fixing this by running: sudo apt install libsdl2-ttf-2.0-0

So thus far, as far as I can tell, this fixes it.

A note for anyone else reading this: the first time I ran it, it complained with: E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

I just ran the mentioned update command (if you are like me and were planning on skipping it)

cosmologicon commented 3 years ago

Glad to hear it!

dario777 commented 3 years ago

god bless you