1

I'm trying to compile a game that I made in python. I'm using Python 2.7 and Pygame 1.9.1 and it work's when I open it in terminal (~$ python game.py) on my Linux Mint 14. I would like to make it work on computers that don't have Python and Pygame installed. I try to compile the script game.py with cx_freeze (~$ python setup.py build). It create a folder but the game can not be started. When I open it in terminal (./game) I got the some error:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/cx_Freeze/initscripts/Console.py", line 29, in <module>
    exec code in m.__dict__
  File "game.py", line 24, in <module>
  File "/usr/lib/python2.7/dist-packages/pygame/sysfont.py", line 555, in SysFont
    initsysfonts()
  File "/usr/lib/python2.7/dist-packages/pygame/sysfont.py", line 524, in initsysfonts
    fonts = initsysfonts_unix()
  File "/usr/lib/python2.7/dist-packages/pygame/sysfont.py", line 460, in initsysfonts_unix
    entries = toascii(flout)
  File "/usr/lib/python2.7/dist-packages/pygame/sysfont.py", line 33, in toascii
    return raw.decode('ascii', 'ignore')
LookupError: unknown encoding: ascii

How to fix it?

The setup.py file is:

from cx_Freeze import setup, Executable
setup( name = "Game",
       version = "1.0",
       description = "Igra",
       executables = [Executable("game.py")] )

game.py has 180 lines and maybe it's not clearly written so I hope I don't have to put it here but I used:

import pygame
import random
import time
...
open("save.txt", "r") #maybe this is not working in pygame
...
pygame.font.SysFont("arial", 15) #maybe that's the problem
#or something else is the problem

Thank you for your help. If necessary, I will put the script game.py here.

Mislavoo7
  • 567
  • 1
  • 6
  • 15

0 Answers0