Unable to import NHunspell.dll using ctypes in Python

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Jun 25 03:07:20 EDT 2013


On 25/06/2013 07:23, akshay.ksth at gmail.com wrote:
>
>
> Im required to import ha certain dll called 'NHunspell.dll' which is used for Spell Checking purposes. I am using Python for the software. Although I checked out several websites to properly use ctypes, I have been unable to load the dll properly.
>
> When I use this code.
>
>    from ctypes import *
>    hunspell = cdll.LoadLibrary['Hunspellx64.dll']
>
> I get an error
>
>    hunspell = cdll.LoadLibrary['Hunspellx64.dll']
>    TypeError: 'instancemethod' object has no attribute '__getitem__'
>
> I guess it might a problem with the structure of the dll. But I have no idea how to import the dll properly.
>

 >>> from ctypes import *
 >>> help(cdll.LoadLibrary)
Help on method LoadLibrary in module ctypes:

LoadLibrary(self, name) method of ctypes.LibraryLoader instance.

So looks as if you need:-

hunspell = cdll.LoadLibrary('Hunspellx64.dll')

-- 
"Steve is going for the pink ball - and for those of you who are 
watching in black and white, the pink is next to the green." Snooker 
commentator 'Whispering' Ted Lowe.

Mark Lawrence




More information about the Python-list mailing list