0

So I made an executable of my python script using cx_freeze but when I open it the window only stays for a fraction of a second before disappearing. I opened it directly with cmd and this is the error it displayed:

Traceback (most recent call last):
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 117, in     <module>
    try: import pygame.display
  File "ExtensionLoader_pygame_display.py", line 22, in <module>
  File "ExtensionLoader_pygame_display.py", line 14, in __bootstrap__
  File "ExtensionLoader_pygame_surface.py", line 22, in <module>
  File "ExtensionLoader_pygame_surface.py", line 14, in __bootstrap__
ImportError: No module named _view

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python32\lib\site-packages\cx_Freeze\initscripts\Console3.py",     line 27, in <module>
    exec(code, m.__dict__)
  File "c:\users\admin\desktop\project2.py", line 1, in <module>
    import pygame
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 118, in     <module>
    except (ImportError,IOError):display=MissingModule("display",     geterror(), 1)
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 61, in     __init__
    self.warn()
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 85, in warn
    warnings.warn(message, RuntimeWarning, level)
  File "C:\Python\32-bit\3.2\lib\warnings.py", line 18, in showwarning
  File "C:\Python\32-bit\3.2\lib\warnings.py", line 25, in formatwarning
  File "C:\Python\32-bit\3.2\lib\linecache.py", line 15, in getline
  File "C:\Python\32-bit\3.2\lib\linecache.py", line 41, in getlines
  File "C:\Python\32-bit\3.2\lib\linecache.py", line 127, in updatecache
  File "C:\Python\32-bit\3.2\lib\codecs.py", line 300, in decode
UnicodeDecodeError: 'utf8' codec can't decode byte 0x90 in position 2:     invalid start byte

When I compiled the executable it said that it hadn't imported several files from pygame, but "this may not be a problem as they may not be needed." I'm guessing this error is a product of those files not being imported but I don't know how to fix that.

  • Can you provide a small portion of the script you are freezing that demonstrates the problem? Often it doesn't have to include much more than the basic imports. Also, are you using cx_Freeze 5.0? It may help with this particular issue. – Anthony Tuininga Dec 10 '16 at 18:31

1 Answers1

0

I solved the problem. It seemed to be an issue with the version of Python and Pygame that I had, and after getting a more recent version of both everything worked just fine.