[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] py2exe and fonts

[Following up to myself]
> > > > I've tried to freeze several pygame examples
> > > > with py2exe and always get the following error:
> > > > 
> > > > C:\sf\py2exe\tests\pygame-examples\dist\aliens>aliens
> > > > Traceback (most recent call last):
> > > >   File "<string>", line 432, in ?
> > > >   File "<string>", line 404, in main
> > > > RuntimeError: Couldn't load font file
The reason is easy to find when looking at the source src/font.c.

font_defaultpath is determined in the following way:

pygame is imported, since this is a module, the filename
of it is something like "c:\python21\pygame\__init__.py".
The "__init__.py" tail is stripped off, and "bluebold.ttf"
is appended, resulting in "c:\python21\pygame\bluebold.ttf".

If run in a py2exe'd executable, the filename of pygame
is something like '<package pygame.__init__>' or whatever,
at least the result will not be a usable filename pointing
to bluebold.ttf.

Pete, can (and should?) this be fixed in font.c?


pygame mailing list