Re: Ctypes Error: Why can't it find the DLL.
- From: Chetan <pandyacus.xspam@xxxxxxxxxxxxxxxxxxx>
- Date: Wed, 25 Oct 2006 01:21:14 GMT
"Mudcat" <mnations@xxxxxxxxx> writes:
Is the DLL loadable from a standalone C program?
All that is needed is a call to LoadLibrary() and check the return.
If the full path is not specified, the dll is searched in the predefined order
- I believe it is
executable directory - in this case, directory of python.exe
current directory - set the current drive and path to whereever you want
before trying to load the dll
windows system directory
windows directory
Directories specified in PATH evnvironment variable
-Chetan
Hi,.
I can't figure out why ctypes won't load the DLL I need to use. I've
tried everything I can find (and the ctypes website is down at the
moment). Here's what I've seen so far.
I've added the file arapi51.dll to the system32 directory. However
when I tried to access it I see this:
Traceback (most recent call last):print windll.arapi51 # doctest: +WINDOWS
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\ctypes\__init__.py", line 387, in
__getattr__
dll = self._dlltype(name)
File "C:\Python24\Lib\site-packages\ctypes\__init__.py", line 312, in
__init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Errno 126] The specified module could not be found
So then I use the find_library function, and it finds it:
'C:\\WINNT\\system32\\arapi51.dll'find_library('arapi51.dll')
At that point I try to use the LoadLibrary function, but it still can't
find it:
Traceback (most recent call last):windll.LoadLibrary('C:\WINNT\system32\arapi51.dll')
File "<interactive input>", line 1, in ?
File "C:\Python24\Lib\site-packages\ctypes\__init__.py", line 395, in
LoadLibrary
return self._dlltype(name)
File "C:\Python24\Lib\site-packages\ctypes\__init__.py", line 312, in
__init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Errno 126] The specified module could not be found
What am I doing wrong? I've used ctypes before and not had this
problem. Before, I've just added the file to the system32 directory and
not had this problem.
On another note, if I wanted to include these DLL's to be a part of an
installable package, how would I configure ctypes to use DLL's from a
local directory?
Thanks,
Marc
- References:
- Ctypes Error: Why can't it find the DLL.
- From: Mudcat
- Ctypes Error: Why can't it find the DLL.
- Prev by Date: win32com problem
- Next by Date: Re: I like python.
- Previous by thread: Re: Ctypes Error: Why can't it find the DLL.
- Next by thread: Re: Ctypes Error: Why can't it find the DLL.
- Index(es):
Relevant Pages
|