Your solution did not work Aaron :( thanks for the response though!

However I did solve it,

From my blog:

If you get the errors at the bottom of this post while trying to use pygame.font.Font or pygame.font.SysFont and py2exe here is a simple fix.

Be sure to include ‘pygame’ as a package to your py2exe script. Also you will need to copy SDL.dll and SDL_ttf.dll from the pygame directory. If you use the default python font you will also need to include that as well.

I have been wrecking my brain the last two and a half days trying to solve this problem.

In my last attempt at solving the problem, I figured “Heck, it won’t hurt to grab every DLL from system32, pygame and what ever else I could find and put them in my dist directory”. I almost cried with joy when it worked! I narrowed it down to SDL.dll and SDL_ttf.dll are the magick files.

Is this a bug that py2exe does not find these and include them automatically?
Using optimize 2, bundle_files 1, nozip

Helpful code:

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')
Traceback (most recent call last):
File "myrts.py", line 1, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "scene.pyo", line 23, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "world.pyo", line 31, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "tileengine.pyo", line 32, in <module>
File "zipextimporter.pyo", line 82, in load_module
File "widgets.pyo", line 18, in <module>
File "zipextimporter.pyo", line 98, in load_module
ImportError: MemoryLoadLibrary failed loading pygame\font.pyd

Traceback (most recent call last):
File "myrts.py", line 1, in <module>
File "scene.pyo", line 23, in <module>
File "world.pyo", line 31, in <module>
File "tileengine.pyo", line 32, in <module>
File "widgets.pyo", line 18, in <module>
File "pygame\font.pyo", line 12, in <module>
File "pygame\font.pyo", line 10, in __load
ImportError: DLL load failed: The specified module could not be found.

-Thadeus

http://thadeusb.com


Charles de Gaulle  - "The better I get to know men, the more I find myself loving dogs."

On Wed, Apr 15, 2009 at 2:22 AM, Aaron R. Short <fuzzyfonzy@yahoo.com> wrote:
I had a bunch of these on my project and usually it's just like the message says, some module isn't getting auto compiled in with py2exe's auto crawler. If you expressly add it to the script it fixed my errors. Here's a snipit from my script. note that includes are modules and packages are well packages. don't put a package in includes or a module in packages I found out the hard way it doesn't work.
 
includes = [
'cairo',
'pango',
'pangocairo',
'atk',
'gobject',
'tarfile', #fixes exportpkg
#GRAMPS modules not being auto pulled in.
'docgen.ODSDoc',
'docgen.OpenSpreadSheet',
'GrampsDbUtils._GedcomStageOne',
'ReportBase._BookFormatComboBox',
'Date',
'ExportOptions',
'ImgManip',
'Sort',
'soundex',
'SubstKeywords',
]
packages = [
'encodings',
#GRAMPS packages not being auto pulled in.
'gen', #auto misses gen.proxy and that gen is a package.
]            
   
setup(
    name = const.PROGRAM_NAME,
    #current version of py2exe barks and doesn't put anything in if alpha
    #characters are here
    version = numberic_only_re.sub('.', const.VERSION),
    #version = "3.1.1",
    description = const.COMMENTS,
    author = const.AUTHORS,
    #author_email = ??,
    url = const.URL_HOMEPAGE,
   
    #gets rid of the zip file and puts all the files into the exe
    zipfile = None,
   
    windows = [
                  {
                      'script': 'gramps.py',
                      'icon_resources': [(1, "images\\ped24.ico")],
                  }
              ],
    # console = [
                  # {
                      # 'script': 'gramps.py',
                      # 'icon_resources': [(1, "images\\ped24.ico")],
                  # }
              # ],             
             
    options = {
                 
                  'py2exe': {
                      #'bundle_files': 2, #breaks it for some reason
# Valid values for bundle_files are:
# 3 (default) don't bundle
# 2 bundle everything but the Python interpreter
# 1 bundle everything, including the Python interpreter                      
                      #'compressed': 1,
                      'dist_dir': dist_dir,
                      'excludes': excludes,
                      'includes': includes,
                      'optimize': 2, #2 is same as running python -00
                      'packages': packages,
                  }
              },
    data_files=dataFiles,             
   
 
)


From: Thadeus Burgess <thadeusb@thadeusb.com>
To: py2exe-users@lists.sourceforge.net
Sent: Tuesday, April 14, 2009 10:14:58 PM
Subject: [Py2exe-users] font module not available

Would anyone be so kind as to help me figure out why py2exe will not use the font module from pygame?

I have searched for hours and turned up nothing.

I am using the pygame2exe script, and running python 2.6

Obviously I need fonts for a game :)

I have tried solutions such as using font and including pygames default font into the directory, and a few other solutions to no avail.

It does work outside of py2exe

taceback...

C:\Documents and Settings\Thadeus Burgess\My Documents\NetBeansProjects\MyRTS\dist\My RTS.exe:68: RuntimeWarning: use font: MemoryLoadLibrary failed loading pygame\font.pyd
Traceback (most recent call last):
  File "myrts.py", line 106, in <module>
  File "myrts.py", line 75, in run
  File "scene.pyo", line 97, in load
  File "widgets.pyo", line 107, in __init__ #loads the pygame.font module here.
  File "pygame\__init__.pyo", line 70, in __getattr__
NotImplementedError: font module not available

thanks

-Thadeus