Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python import error "DLL load failed" | Python

I'm serving a Django app behind IIS6 web server.

The test server runs perfectly, but when running behind the web server a module failes to import I get this error:

Error loading pyodbc module: DLL load failed: The specified module could not be found


Just for the record the module is pyodbc

The site is served though isapi by using isapi-wsgi


Any ideas? It would really make my day! :)

like image 740
RadiantHex Avatar asked Nov 01 '10 12:11

RadiantHex


People also ask

How do I fix dll errors in Python?

Run GoogleDriveSync.exe in Compatibility Mode If you're only encountering the Error Loading Python DLL error, the moment your Google Drive installation attempts to sync your files, chances are you will be able to fix the problem by forcing the executable to run in compatibility mode with Windows 7.

How do you fix Importerror dll load failed the specified module could not be found?

importerror: dll load failed: The specified module could not be found error occurs because of the incompatibilities of Microsoft Visual C++ (Visual Studio) versions. The best way to fix this error (importerror: dll load failed) is to reinstall/ install the Microsoft Visual C++ distribution.

What is dll load error?

Error in loading DLL occurs when a program calls upon a DLL file to perform a certain task, and the specified DLL cannot be loaded. These errors indicated by various error messages, such as: Error loading dumcp. dll.

Where is Python3 dll located?

Python3. dll is found in PASW Statistics 18, LibreOffice 6.2. 5, and iClone 7.41. 2525.


2 Answers

This error is a PITA: it is often caused by missing symbols in dll (because a dependent dll was not found, etc...). You should check the .pyd with dependency walker, or look into the windows log which may log such errors depending on your configuration.

like image 82
David Cournapeau Avatar answered Oct 22 '22 12:10

David Cournapeau


I have recently been battling with setting up Django/Python on IIS 7 on Windows 2008 with MS SQL 2008. I bumped into the same problem as you did. I was using PyODBC-2.1.8. I compiled the modules from source. I used the mingw compiler to compile them from source. Nothing worked.

I then downgraded to PyODBC-2.1.7. And it worked! I used the binary available from the site for the Python 2.6 distribution (that is the version of Python I am using).

I hope this may help.

like image 34
ayaz Avatar answered Oct 22 '22 11:10

ayaz