PDA

View Full Version : Error occurred when run program packed by py2exe



redice
20th April 2011, 04:18
I packed a python program (involving PyQT4) with py2exe, the exe file run normally on my machine, but when i copy it to another machine, error occurred like following (in log file):

File "PyQt4\QtGui.pyc", line 12, in File "PyQt4\QtGui.pyc", line 10, in __load ImportError: DLL load failed:

more details:

i am using Python 2.5.
MSVCR71.dll is available in the same directorywith the exe file.
my setup.py script:

# coding: utf-8

from distutils.core import setup

import py2exe

import sys



#this allows to run it with a simple double click.

sys.argv.append('py2exe')


script = [{

"script":"test.py",

'icon_resources':[(0, 'main.ico'),]

}]



py2exe_options = {

"includes":["sip",],

"dll_excludes": ["MSVCP90.dll",]

}

setup(windows=script, options={'py2exe':py2exe_options})

ChrisW67
20th April 2011, 05:14
As a non-PyQt user I am just guessing wildly... but I expect you will need the Qt DLLs too. QtCore4.dll, QtGui4.dll etc.

redice
20th April 2011, 07:54
As a non-PyQt user I am just guessing wildly... but I expect you will need the Qt DLLs too. QtCore4.dll, QtGui4.dll etc.

yes, QtCore4.dll, QtGui4.dll were all in the same directory with the exe file. Even i copy all the dll in the "PyQt4\bin" into the same directory with the exe file, also has this problem.