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 9242083
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:30:25+00:00 2026-06-18T08:30:25+00:00

I built the small application using PyQt and made it executable setup with py2exe.

  • 0

I built the small application using PyQt and made it executable setup with py2exe. Its all good in my laptop, but when I try to distribute the application to other machines, its not able to open, giving following error in .log file.

Traceback (most recent call last):
  File "viewer.py", line 5, in <module>
  File "PyQt4\QtCore.pyo", line 12, in <module>
  File "PyQt4\QtCore.pyo", line 10, in __load
ImportError: DLL load failed: %1 is not a valid Win32 application.

I tried a lot but not able to get this resolve. Please help me !!

EDIT :

Here is the setup.py

#!/usr/bin/python
import sys
#C:\Windows\winsxs\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91

#sys.path.append("C:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\redist\\x86\\Microsoft.VC90.CRT")


import warnings
warnings.filterwarnings(action="ignore", message='the sets module is deprecated')
from distutils.core import setup
import py2exe

manifest = '''
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1"
manifestVersion="1.0">
<assemblyIdentity
version="0.64.1.0"
processorArchitecture="x86"
name="Controls"
type="win32"
/>
<description>Your Application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
    type="win32"
    name="Microsoft.Windows.Common-Controls"
    version="6.0.0.0"
    processorArchitecture="X86"
    publicKeyToken="6595b64144ccf1df"
    language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
'''

'''
installs manifest and icon into the .exe
but icon is still needed as we open it
for the window icon (not just the .exe)
changelog and logo are included in dist
'''

sys.path.append('C:\\WINDOWS\\WinSxS\\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.21022.8_none_bcb86ed6ac711f91')

excludes = ["pywin", "pywin.debugger", "pywin.debugger.dbgcon",
            "pywin.dialogs", "pywin.dialogs.list"]

setup(
#options = {"py2exe": {"includes":["sip"],"dll_excludes": ["MSVCP90.dll"]}},
options = {"py2exe": {"typelibs":
                          # typelib for WMI
                          [('{565783C6-CB41-11D1-8B02-00600806D9B6}', 0, 1, 2)],
                          # create a compressed zip archive
                          "compressed": 1,
                          "optimize": 2,
                          "excludes": excludes,
                          "includes":["sip","PyQt4"]}},

    # The lib directory contains everything except the executables and the python dll.
    # Can include a subdirectory name.
    zipfile = "lib/shared.zip",

windows = [
    {
    "script": "viewer.py",
    #"icon_resources": [(1, "favicon.png")],
    #"other_resources": [(24,1,manifest)]
    }
    ],
    data_files=["msvcm90.dll","msvcp90.dll","msvcr90.dll"]

)
  • 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-18T08:30:27+00:00Added an answer on June 18, 2026 at 8:30 am

    You should post your setup.py so we can take a look at it. Anyhow, something to this effect should work for your py2exe setup.py. You might have to adjust the bundle_files and zipfile parameters to work with our setup. Make sure to replace ‘insert qt path here’ with the proper path for the QT dll’s and enter the actual QT dll names for ‘a.dll’, ‘b.dll’, ‘c.dll’, …

    setup.py:

    # USAGE: 'python setup.py py2exe'
    from distutils.core import setup
    import py2exe, sys
    
    sys.argv.append('py2exe')
    
    setup(
        data_files=[
                    ('.','viewer.ico']),
                    ('insert qt path here', ['a.dll','b.dll', 'c.dll'])
                   ],
    
        options={'py2exe':{
                           'bundle_files':   1, # 3 - Don't pack, 2 - Pack all but interpreter, 1 - pack all.
                           'unbuffered':     True,
                           'optimize':       2,
                           'compressed':     1
                          },
                }, 
    
        windows=[
                 {
                  'script':'viewer.py',
                 },
                ],
    
        zipfile = None# None = All in EXE does not work with tcl/ttk gui's, Else 'shared.lib' make a lib file with name specified.
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I made a small web application using Netbeans , it contains some JSP pages
using several codes available throughout the site, I built a small application that would
I have built a small web application in asp.net c# in VS 2010 using
I have a small ajax application built with php. Using phpMyAdmin I have set
We have a small application we built in our spare time using the latest
So far I've only built small graphical applications, using swing and JComponents as I
I built a small cms for personal websites using Rails. Each site has a
Initially I thought it was a CSS issue but I built a small sample
I have built a small app using javascript. I am using javascript for form
I have a small VB.NET application that I'm working on using the full version

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.