[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Problem with py2exe and font.pyd



Hi,

I found a better solution/workaround.

For some reason py2exe regards the SDL_ttf.dll file as a system owned
dll and excludes it from the distribution package.

To overide this you can use a trick found in py2exe's FAQ.

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

This will make sure that the SDL_ttf.dll isn't recognized as a system dll.

Best Regards
/John Eriksson

2009/8/19 John Eriksson <john@xxxxxxxxxxxx>:
> Hi,
>
> I found a solution. I had to copy the following DLL's manualy:
>
> SDL_ttf.dll
> libfreetype-6.dll
>
> Why arn't those included automaticly?
> Is there a way of telling py2exe to include those?
>
> Best Regards
> /John Eriksson
>
> 2009/8/18 René Dudfield <renesd@xxxxxxxxx>:
>> Hi,
>>
>> this post seems to have a solution to that problem:
>> http://blog.thadeusb.com/tag/memoryloadlibrary/
>>
>> What dlls do you have in that directory?  Are SDL.dll and SDL_ttf.dll
>> being copied?
>>
>> cheers,
>>
>>
>>
>>
>> On Tue, Aug 18, 2009 at 3:25 PM, John Eriksson<john@xxxxxxxxxxxx> wrote:
>>> Hi,
>>>
>>> I'm trying to use py2exe and get the following error when wxwcuting
>>> the exe file.
>>>
>>> C:\Users\john\workspace\FlickrBackupTool\src\FlickrTagTool\FlickrTagTool.exe\lib\GameGUI.py:40:
>>> RuntimeWarning: use font: MemoryLoadLibrary failed loading
>>> pygame\font.pyd
>>> (ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
>>> Traceback (most recent call last):
>>>  File "FlickrTagTool.py", line 758, in <module>
>>>  File "FlickrTagTool.py", line 754, in main
>>>  File "FlickrTagTool.py", line 737, in main_loop
>>>  File "FlickrTagTool.py", line 221, in __init__
>>>  File "FlickrTagTool.py", line 327, in setup_gui
>>>  File "lib\GameGUI.pyo", line 40, in load_font
>>>  File "pygame\__init__.pyo", line 70, in __getattr__
>>> NotImplementedError: font module not available
>>> (ImportError: MemoryLoadLibrary failed loading pygame\font.pyd)
>>>
>>> But when I looked in the location where other pygame/*.pyd files is
>>> located it's there.
>>>
>>> I'm using Windows7, Python 2.6 and Pygame 1.9.1
>>>
>>> Please advice!
>>>
>>> Best Regards
>>> /John Eriksson
>>>
>>
>