Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8659631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:03:29+00:00 2026-06-12T16:03:29+00:00

I want to create a .exe file. I’m using Python 2.7.3 with wxPython for

  • 0

I want to create a .exe file. I’m using Python 2.7.3 with wxPython for the GUI. I’ve installed py2exe for Python 2.7 and tried to create a .exe file following the tutorial at http://www.py2exe.org/index.cgi/Tutorial

When I try to run my created .exe file, I get following error:

File "wx\_gdi.pyc",line823, in BitmapFromImage wx._core.PyAssertionError: 
C++ assertion "image.OK()" failed at ..\..\src\msw\bitmap.cpp(802) in 
wxBitmap::CreateFromImage(): invalid image

So I looked into my code and the following line is causing the problem:

self.bmpSun = wx.StaticBitmap(self, wx.ID_ANY, wx.BitmapFromImage(wx.Image('images/sun.gif', wx.BITMAP_TYPE_ANY)), pos = (0,0))

When I browse to the source folder and run the main.py file myself, my app runs fine. I haven’t found any help online so far. Can anybody solve this problem/suggest reliable alternatives for py2exe? Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:03:30+00:00Added an answer on June 12, 2026 at 4:03 pm

    The line that errors out is looking for an image in the Images folder. That’s a path relative to the .exe file created by py2exe. So you need to be sure that that folder exists in correct position relative to the exe, and that it is populated with the images you are going to use. You can do this 2 ways. Either copy the folder to where the exe will reside, or use the data_files keyword arg in the script that makes the .exe. Here’s the pertinent part of one of my setup scripts, showing a data_files list of tuples and use of the data_files keyword arg later:

    data_files = [('Images', glob('Images/*.*')),
                                ]
    
    includes = ['win32com.decimal_23', 'datetime']
    
    excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses',  'pywin.debugger',
                'pywin.debugger.dbgcon', 'pywin.dialogs', 'tcl',
                'Tkconstants', 'Tkinter', 'unittest']
    packages = []
    
    dll_excludes = ['libgdk-win32-2.0-0.dll', 'libgobject-2.0-0.dll', 'tcl84.dll',
                    'tk84.dll','MSVCP90.dll']
    
    setup(
        data_files = data_files,
        options = {"py2exe": {"compressed": 2,
                              "optimize": 2,
                              "includes": includes,
                              "excludes": excludes,
                              "packages": packages,
                              "dll_excludes": dll_excludes,
                              "bundle_files": 1,
                              "dist_dir": "dist",
                              "xref": False,
                              "skip_archive": False,
                              "ascii": False,
                              "custom_boot_script": '',
                             }
                  },
        zipfile = None,
        windows = [filename]
        )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create an exe file using C# which will send emails. I
I want to create a Gameboy emulator which runs directly from the exe file,
I want to write a program (create an exe file) to uninstall a program
I want to hide the tool I used to create an .exe file. I
I want to know simply how to create a batch file from .exe file?
I have write some function to create an exe file using ILGenerator. What I
I want to create an exe file which includes mysql.msi and java.zip. I have
I want to create desktop shortcut for exe file through program. I do not
I want to point to a http://somesite.com/somefile.exe and check the file version of the
I want to create a .exe file of my application. I read many posts

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.