python + opencv "dll load failed"
Question: I'm trying to install opencv on my machine as explained in the book: "Packtpub
OpenCV Computer Vision with Python Apr 2013"

It says that in order to run kinect you need to compile openCV with some stuff
in it, so I downloaded openCV .exe that extracts to a 3.2gb folder and
proceeded with all the steps...

Used CMaker, used the compiler MinGW, and everything as the book said

Than it tells me to try running some examples... but when I try to run
drawing.py as recommended by the book, and all the others, it says:

python drawing.py

* * *

OpenCV Python version of drawing

traceback< most recent call last>:

File "drawing.py", line 7, in

    
    
    import cv2.cv as cv
    

ImportError: DLL load failed: Invalid access to memory location.

* * *

I saw a lot of people saying this problem is fixed by adding the path to the
bin of openCV dlls to path...

how do I find out which dll name is missing so I can find the name of it and
find the folder where it is?

I have a x64 computer but the book tells me to install everything x86 because
it is harder to get some minor bugs, maybe a version incompatibility between
openCV, compiler, cmaker, and python?

I've tried to add a lot of folders to "path" variable and it didn't work

please tell me how I find out which dlls are missing so I can search for them
on the computer or some other way to solve this problem because I'm just out
of ideas


Answer: I don't have a high enough rep to add a comment otherwise I would but
something you can do is start python with the -v option.

doing that will add a bit more to the output console and it will cause the
python VM to output where it is looking for things when it tries looking for
things, especially when failures occur. I've found that to be helpful when
trying to hunt problems such as path problems down.

It also sounds like you haven't got your paths setup correctly. Have you
looked at [ImportError: DLL load failed: %1 is not a valid Win32
application](http://stackoverflow.com/questions/14629818/importerror-dll-load-
failed-1-is-not-a-valid-win32-application?rq=1) ? If a DLL was expected in a
certain location but wasn't loaded or present but then 'called' via a
LoadLibrary (without checking to see if it was actually loaded) that might
cause such an error. It is probably the fault of the original DLL that failed
to verify the subsequent DLL was loaded instead of just assuming the
LoadLibrary call succeeded.

In addition to the python -v yourmodule.py option you could also try running
an strace (if you are on unix -- but it doesn't sound like you are). I used to
use SoftICE on Windows for digging down deep. If you know the package or the
DLL that is at the root of the problem, and have access to a dll export tool,
you should be able to get a list of the dependencies the dll needs (external
functions it relies on). Then you just need to know or find those functions it
relies on from other DLLs. It's been awhile since I used to had do this sort
of stuff all the time to locate functions in other DLLs but it is something
that is entirely doable from a spelunkers perspective. But there are probably
easier ways to go about it.

I'd start with the python -v approach first.

