Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #49131

Re: Unable to import NHunspell.dll using ctypes in Python

From Mark Lawrence <breamoreboy@yahoo.co.uk>
Subject Re: Unable to import NHunspell.dll using ctypes in Python
Date 2013-06-25 08:07 +0100
References <23e633db-afbe-4edc-9291-5a9e242e86d0@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3799.1372144029.3114.python-list@python.org> (permalink)

Show all headers | View raw


On 25/06/2013 07:23, akshay.ksth@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Unable to import NHunspell.dll using ctypes in Python akshay.ksth@gmail.com - 2013-06-24 23:23 -0700
  Re: Unable to import NHunspell.dll using ctypes in Python Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-25 08:07 +0100
    Re: Unable to import NHunspell.dll using ctypes in Python akshay.ksth@gmail.com - 2013-06-25 00:32 -0700
      Re: Unable to import NHunspell.dll using ctypes in Python Dave Angel <davea@davea.name> - 2013-06-25 03:45 -0400
      Re: Unable to import NHunspell.dll using ctypes in Python Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-06-25 09:54 +0200
      Re: Unable to import NHunspell.dll using ctypes in Python Dave Angel <davea@davea.name> - 2013-06-25 09:55 -0400
  Re: Unable to import NHunspell.dll using ctypes in Python akshay.ksth@gmail.com - 2013-06-25 00:58 -0700
    Re: Unable to import NHunspell.dll using ctypes in Python Dave Angel <davea@davea.name> - 2013-06-25 10:05 -0400
  Re: Unable to import NHunspell.dll using ctypes in Python akshay.ksth@gmail.com - 2013-06-25 01:04 -0700
    Re: Unable to import NHunspell.dll using ctypes in Python Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2013-06-25 10:32 +0200
  Re: Unable to import NHunspell.dll using ctypes in Python akshay.ksth@gmail.com - 2013-06-25 07:52 -0700

csiph-web