Ошибка модуля шрифта при использовании pygame2exe - PullRequest
3 голосов
/ 16 июня 2011

Я использовал Pygame2exe с веб-сайта Pygame, и это избавило от проблемы с .dlls, но все еще остается ошибка.
Единственный шрифт, который я использую, это стандартный pygameшрифт (freesansbold.ttf), и я включил его копию в каталог с игрой.
Кроме того,
Я использую класс Font, а не класс SysFonts, который ямысль решит мою проблему.
Есть мысли?

C:\Python26\apple_orchard\dist\appleorchard.exe:27: RuntimeWarning: use font: MemoryLoadLibrary failed loading pygame\font.pyd
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
Traceback (most recent call last):
  File "appleorchard.py", line 165, in <module>
  File "appleorchard.py", line 27, in __init__
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: font module not available
(ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)

Ответы [ 2 ]

3 голосов
/ 16 июня 2011

Ваша проблема выглядит очень похожей на эту: http://thadeusb.com/weblog/2009/4/15/pygame_font_and_py2exe

Попробуйте добавить "sdl_ttf.dll" в список системных библиотек, как это:

origIsSystemDLL = py2exe.build_exe.isSystemDLL # save the orginal before we edit it
def isSystemDLL(pathname):
    # checks if the freetype and ogg dll files are being included
    if os.path.basename(pathname).lower() in ("libfreetype-6.dll", "libogg-0.dll", "sdl_ttf.dll"):
            return 0
    return origIsSystemDLL(pathname) # return the orginal function
py2exe.build_exe.isSystemDLL = isSystemDLL # override the default function with this one
0 голосов
/ 16 июня 2011

Похоже, отсутствует модуль pygame.font.Вы упаковали это?

...