2012-07-23 2 views
1

Я написал следующие коды в установочном файле и включил обе папки sdl_ttf.dll "," SDL.dll в папку по умолчанию. Но он показывает сообщение об ошибке:NotImplementedError: модуль шрифта недоступен

NotImplementedError:font module not available 
<Import error: DLL load failed:can't find assigned module> 

Код

from distutils.core import setup 

import py2exe,sys,os 
import pygame 

setup(console=['blackjack.py']) 

origIsSystemDLL = py2exe.build_exe.isSystemDLL 
def isSystemDLL(pathname): 
     if os.path.basename(pathname).lower() in ["sdl_ttf.dll", "SDL.dll"]: 
       return 0 
     return origIsSystemDLL(pathname) 
py2exe.build_exe.isSystemDLL = isSystemDLL 

pygamedir = os.path.split(pygame.base.__file__)[0] 
os.path.join(pygamedir, pygame.font.get_default_font()), 
os.path.join(pygamedir, 'SDL.dll'), 
os.path.join(pygamedir, 'SDL_ttf.dll') 

там что-то не так?

ответ

0

Ваш чек

if os.path.basename(pathname).lower() in ["sdl_ttf.dll", "SDL.dll"]: 

не будет работать, так как вы звоните lower() по имени файла, но использовать SDL.dll вместо sdl.dll, так py2exe не будет включать в себя библиотеку SDL.

Вы также можете попробовать использовать скрипт this из вики-игры pygame.

Смежные вопросы