Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

python:can not build exe file with png from py2exe

Started by nickme Mar 1, 2013 at 3:23 AM 0 replies 2k views
Original Post
nickme
nickme

hi

i am having trouble creating an exe file from python script using pygame, when i have to include png files. when i build an exe file without the png file, the exe file run fine. the only problem is when i used pygame and include png files.

i hope some one can give me some pointers and point out the errors that i made.

note: i import pygame._view, but i still have the _view errors. :)

i include the exe log and the setup.py below.

thanks in advance.

C:\Python\Wormy\dist\wormy.exe:12: RuntimeWarning: import display: No module named _view
(ImportError: No module named _view)
C:\Python\Wormy\dist\wormy.exe:12: RuntimeWarning: import draw: No module named _view
(ImportError: No module named _view)
C:\Python\Wormy\dist\wormy.exe:12: RuntimeWarning: import image: No module named _view
(ImportError: No module named _view)
C:\Python\Wormy\dist\wormy.exe:12: RuntimeWarning: import pixelcopy: No module named _view
(ImportError: No module named _view)
C:\Python\Wormy\dist\wormy.exe:12: RuntimeWarning: import transform: No module named _view
(ImportError: No module named _view)
Traceback (most recent call last):
File "wormy.py", line 43, in
File "pygame\__init__.pyc", line 70, in __getattr__
NotImplementedError: image module not available
(ImportError: No module named _view)
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
File "wormy.py", line 44, in
pygame.error: Couldn't open img/apple.png
and the setup.py.
'''
Created on Feb 21, 2013
to run this script, type: python setmeup.py py2exe -v
@author: rob
'''
from distutils.core import setup
import py2exe, os
import pygame._view
origIsSystemDLL = py2exe.build_exe.isSystemDLL
def isSystemDLL(pathname):
if os.path.basename(pathname).lower() in ("sdl_ttf.dll", "libogg-0.dll"):
return 0
return origIsSystemDLL(pathname)
py2exe.build_exe.isSystemDLL = isSystemDLL
dfiles = [('.', ['img/splash3.png', 'img/apple.png'])]
setup(windows = [{"script": "wormy.py"}],
data_files = dfiles,
author="Robert Tran",
author_email="tj3robert@gmail.com")
# data_files=[('img',['apple.png', 'splash3.png'])])
print "\n\t terminated."
nickme
nickme

hi

i finally got it.

bye

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.