views:

21

answers:

1

ctypes.WinDLL("C:\Program Files\AHSDK\bin\ahscript.dll")

Traceback (most recent call last): File "", line 1, in File "C:\Python26\lib\ctypes_init_.py", line 353, in init self._handle = _dlopen(self._name, mode) WindowsError: [Error 126] The specified module could not be found

how can i solve it ... i found the _dlopen in C:\Python26\lib\ctypes_init_.py , but i really dont know how to solve it ...

+3  A: 

Backslashes are an escape character within strings, as demonstrated in the example below:

>>> print "C:\Program Files\AHSDK\bin\ahscript.dll"
C:\Program Files\AHSDinhscript.dll

You can solve the problem by placing an r before the string, which prevents the backslash from working as an escape character:

ctypes.WinDLL(r"C:\Program Files\AHSDK\bin\ahscript.dll")

Alternately, you could escape the backslashes:

ctypes.WinDLL("C:\\Program Files\\AHSDK\\bin\\ahscript.dll")
Daniel Stutzbach
It is working , thx for your help!
wizztjh