Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,149,869 members, 7,806,476 topics. Date: Tuesday, 23 April 2024 at 05:02 PM

Dll Load Failure With Py2exe (python And Qt) - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Dll Load Failure With Py2exe (python And Qt) (5575 Views)

"Qt Creator" Need Solution / HOWTO: Create A Simple API With Python And Flask / Build A Bare Bones Reddit Clone With Python And Flask (hands On Tutorial Thread) (2) (3) (4)

(1) (Reply) (Go Down)

Dll Load Failure With Py2exe (python And Qt) by Nobody: 10:21am On Sep 19, 2009
i've been trying to figure out where the problem lies with no clue yet.
i am getting ImportError: DLL load failed: the specified procedure could not be found.

i smell the problem is from py2exe
and this is what i have in the setup file

from distutils.core import setup
import py2exe

setup(windows=[{"script":"npmcnp.py","icon_resources":[(1,"npmcn.ico"wink]}], options={"py2exe":{"includes":["sip","PyQt4._qt"],'bundle_files': 1}})

i have tried options 2 and 3 also for the bundle_files parameter with no luck.
the DLL it failed to load is psycopg2, psycopg2 is one of the modules needed to run the application

1 Like

Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 2:06pm On Sep 19, 2009
Guy i respect you.You already coding in Qt.Would love to learn that.Join thier forum and ask for help.Qt is the future
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 2:08pm On Sep 19, 2009
Guy i respect you.You already coding in Qt.Would love to learn that.Join thier forum and ask for help.Qt is the future
Re: Dll Load Failure With Py2exe (python And Qt) by jacob05(m): 10:56pm On Sep 19, 2009
Had TheSame problem
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 12:43pm On Sep 20, 2009
Ehm, permission to shoot my maut hia. . . .while i dont know python or what the heck Qt means!
I have some experience with creating and loading DLLs both in C++, Visual Basic, PHP and even loading it on msdos commandline sef.

One thing i have come to realize is that there are many ways of loading DLLs into applications. I am aware of static linkage and dynamic
linkage. So many platforms usually have more than one method of loading DLLs. For instance the dl function in php will fail if the DLL does
not have an iDispatch interface. . . .so for that particular dll you are having issues with loading, go and lookup the documentation of your
language and see how it is implemented. I will not be quick to believe that those DLLs are corrupt. Or better still, try to see if you can get
a sample working code of the implementation of those DLLs from somewhere.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 1:55pm On Sep 20, 2009
Dhtml guy why the absence from nairaland don't you know pple dey look up to ya.How you doing.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 1:55pm On Sep 20, 2009
Dhtml guy why the absence from nairaland don't you know pple dey look up to ya.How you doing.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 6:03pm On Sep 20, 2009
I have been around, just had to reduce my posts 'cos i had loads of work to do. My desk is partially cleared for now.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 9:21am On Sep 22, 2009
Please o, if anyone has found the solution, it will be nice to post it here so that we can all learn. By the way, i just created a php extension with microsoft c++ 6.0 i called it php_hello.dll and it just shows hello world, i am interested in discussing with anyone else knowlegeable in this area. But not on this thread please. DLLs are rather tough areas sometimes.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 7:03pm On Oct 14, 2009
I found it,
the problem is from py2exe adding 2 extra dlls from my Vista, the target machines are 2000/xp/vista
so things works fine on vista while 2000/xp complains of not seeing psycopg2\_psycopg.pyc even though it's there

here is the error,

>> Traceback (most recent call last):
>> File "npmcn.py", line 2, in <module>
>> File "psycopg2\__init__.pyc", line 60, in <module>
>> File "psycopg2\_psycopg.pyc", line 12, in <module>
>> File "psycopg2\_psycopg.pyc", line 10, in __load
>> ImportError: DLL load failed: The specified procedure could not be found.


i just figured Vista keeps shipping something with my app thats not needed or not compatible with other windows version
excluding 2 dlls from the zip did the trick

so 2000/xp kept using the vista version instead of using the native one located in the windows' system32 folder
the too naughty dlls are Secur32.dll and SHFOLDER.dll

i also figured out that py2exe has a way you can exclude dlls
"dll_excludes": ["whatever.dll"]
you will need to add it to the options' argument like below




excludes = ["Secur32.dll", "SHFOLDER.dll"]
setup(
options = {"py2exe": {"includes":["sip","PyQt4._qt"],
"compressed": 1,
"optimize": 2,
"ascii": 1,
"bundle_files": 1,
"dll_excludes": excludes
}},
zipfile = None,
windows = [test_wx],
)

this gave me headache for almost a month, how i wish someone has experienced and posted something like this.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 4:31am On Oct 16, 2009
well, i guess someone has to lead the way
Re: Dll Load Failure With Py2exe (python And Qt) by bb6xt(m): 8:13am On Sep 07, 2014
dhtml18: Please o, if anyone has found the solution, it will be nice to post it here so that we can all learn. By the way, i just created a php extension with microsoft c++ 6.0 i called it php_hello.dll and it just shows hello world, i am interested in discussing with anyone else knowlegeable in this area. But not on this thread please. DLLs are rather tough areas sometimes.

The recommended way to connect your PyQt/Qt application to a database is to use Qt's built-in drivers which is encapsulated in the QtSql module. The built-in drivers support MYQSL, PostgreSQL, MSSQL, Oracle and ODBC. This way you eliminate the external dependency on psycopg2. Packages such as psycopg2 and python-mysql depend on shared objects/DLLs provided by installing the actual database on the machine and may break if your app is deployed on a machine without does extensions installed. Please take a look at QtSql module and you'll see that you really don't need psycopg2. Qt is a very rich framework that has everything built-in. Once when I wrote a Qt app that required consuming an API I used ulrlib/requests for calling the API and python's native threading module but discovered that python threading doesn't play well with Qt so I used QRunnable for threading and QtNetwork and was really impressed. My recommendation is to use Qt components where available as it makes packaging quite a breeze. Personally I found pyinstaller very good for packaging PyQt apps, cx_freeze is a good second choice.
Re: Dll Load Failure With Py2exe (python And Qt) by Nobody: 8:09am On Sep 12, 2014
Try installing the Microsoft Visual C++ 2008 Redistributable Package
(x86):
http://www.microsoft.com/downloads/en/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&displaylang=en

(1) (Reply)

Programmers how much do you earn monthly? / Solution To Tokenmismatchexception Problem In Laravel 5.1 / Thread For International Remote Tech Jobs - US, UK, Canada, Germany, UAE...

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 26
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.