dll in project?

Alf P. Steinbach alfps at start.no
Mon Mar 15 07:37:55 EDT 2010


* Alex Hall:
> On 3/15/10, Ulrich Eckhardt <eckhardt at satorlaser.com> wrote:
>> Alex Hall wrote:
>>> I have a dll I am trying to use, but I get a Windows error 126, "the
>>> specified module could not be found". Here is the code segment:
>>> nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll")
>> In addition to Alf's answer, this can also happen when the OS can't find
>> another DLL that this one depends on.
> 
> Well, os.getcwd() returns "c:\python26", not my program's directory.
> However, I changed the reference to the dll to be
> helpers.progdir+'\\nvdaControllerClient32.dll'
> and still no luck!

Are you sure you get a single directory separator backslash there?

I suggest using the os.path 'join' function, whatever it was called.


> helpers.progdir is a var holding the top-level
> directory of my project, using os.path.

But is that where the DLL resides, or is it in some subdirectory?


> Again, using this more precise
> reference still fails, triggering my except statement in my try/catch
> loop.

Try also checking the arguments & documentation of ctypes.windll.LoadLibrary. I 
know, you probably already done that. But I mention it just in case (I'm not 
familiar with that function at the Python level, so don't know about the args).


Cheers & hth.,

- Alf



More information about the Python-list mailing list