"Jon Clements" <[EMAIL PROTECTED]> writes: > Mudcat wrote: > > > > So then I use the find_library function, and it finds it: > > > > >>> find_library('arapi51.dll') > > 'C:\\WINNT\\system32\\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: > > > > >>> windll.LoadLibrary('C:\WINNT\system32\arapi51.dll') > > Traceback (most recent call last): > > 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\arapi51.dll' > 'C:\\winnt\\system32\x07rapi51.dll' I wondered about it, but that would not explain why it fails in the first case - perhaps the OP now knows what happened. Interestingly I get a different error with the distribution binary for 2.5 - I get "Error 22" instead of "Errno 126", but the message text was same, so I assumed this was from a different version and something had changed about how the errno is reported.
However, I checked the windows error codes and 126 seems to be the correct error. The error code talks about bad command and the corresponding message text reads "The device does not recognize the command." -Chetan > > Jon. -- http://mail.python.org/mailman/listinfo/python-list