ctypes does not load .dll and generate windowsError 127

Chris Angelico rosuav at gmail.com
Tue May 13 05:35:00 EDT 2014


On Tue, May 13, 2014 at 6:45 PM, Ji Xia <ji.xia at nxp.com> wrote:
> Could anybody help me out? I am trying to use python ctypes and load a .dll
> file. It works on my colleagues’ machine, just does not work on mine
>
> Python on my machine is : python 2.7.6
>
> OS: windows 7
>
> Result is always:
>
>   File "C:\Python27\Lib\ctypes\__init__.py", line 365, in __init__
>
>     self._handle = _dlopen(self._name, mode)
>
> WindowsError: [Error 127] The specified procedure could not be found
>
>

It would help to know what DLL you're loading. Are you copying the
exact same DLL file from one computer to the other, or referencing
something that's already there?

It may be that the DLL you name is statically linked to another DLL,
and it's the second one that's causing problems. In that case, even
copying the file across won't solve the problem. Look for a DLL
dependency tree program (you can find them at the other end of a web
search) and see if you have versioning issues.

This isn't actually a Python problem, it's all to do with the loading
of that DLL.

ChrisA



More information about the Python-list mailing list