Sign in to follow this  
nickme

python:can not build exe file with png from py2exe

Recommended Posts

nickme    253

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 <module>
  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 <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
pygame.error: Couldn't open img/apple.png
Traceback (most recent call last):
  File "wormy.py", line 44, in <module>
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."
 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this