Re: Ctypes Error: Why can't it find the DLL.
- From: "Jon Clements" <joncle@xxxxxxxxxxxxxx>
- Date: 25 Oct 2006 01:25:06 -0700
Mudcat wrote:
So then I use the find_library function, and it finds it:
'C:\\WINNT\\system32\\arapi51.dll'find_library('arapi51.dll')
Notice it's escaped the '\' character.
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? [snip]
You need to use either
windll.LoadLibrary(r'c:\winnt\system32\arapi51.dll') or escape the \'s
as the find_library function did. You're getting caught out by \a which
is the alert/bell character. \w and \s aren't valid escape sequences so
you get away with them. I'm guessing it's worked before because you've
been lucky.
Works fine!:
'C:\\winnt\\system32\\smtpctrs.dll''C:\winnt\system32\smtpctrs.dll'
Uh oh, escaped:
'C:\\winnt\\system32\x07rapi51.dll''C:\winnt\system32\arapi51.dll'
Jon.
.
- Follow-Ups:
- Re: Ctypes Error: Why can't it find the DLL.
- From: Chetan
- Re: Ctypes Error: Why can't it find the DLL.
- References:
- Ctypes Error: Why can't it find the DLL.
- From: Mudcat
- Ctypes Error: Why can't it find the DLL.
- Prev by Date: Re: python html 2 image (png)
- Next by Date: dict problem
- 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
|