Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'subject:Python': 0.06; 'attribute': 0.07; 'instance.': 0.09; 'lawrence': 0.09; 'properly.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:using': 0.09; 'python': 0.11; 'name)': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:ctypes': 0.16; 'subject:import': 0.16; 'typeerror:': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'module': 0.19; 'properly': 0.19; '>>>': 0.22; 'import': 0.22; 'load': 0.23; 'header:User-Agent:1': 0.23; 'error': 0.23; 'dll': 0.24; 'looks': 0.24; 'software.': 0.24; 'certain': 0.27; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'idea': 0.28; "skip:' 10": 0.31; 'ball': 0.31; 'ctypes': 0.31; 'checked': 0.32; 'skip:c 30': 0.32; 'checking': 0.33; 'guess': 0.33; 'problem': 0.35; 'but': 0.35; 'next': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'structure': 0.39; 'to:addr:python.org': 0.39; 'unable': 0.39; 'received:org': 0.40; 'called': 0.40; 'how': 0.40; 'black': 0.61; 'email addr:gmail.com': 0.63; 'watching': 0.68; 'websites': 0.72; 'subject:skip:N 10': 0.84; 'white,': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Unable to import NHunspell.dll using ctypes in Python Date: Tue, 25 Jun 2013 08:07:20 +0100 References: <23e633db-afbe-4edc-9291-5a9e242e86d0@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: host-92-24-210-99.ppp.as43234.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 In-Reply-To: <23e633db-afbe-4edc-9291-5a9e242e86d0@googlegroups.com> X-Antivirus: avast! (VPS 130624-2, 24/06/2013), Outbound message X-Antivirus-Status: Clean X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 35 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372144029 news.xs4all.nl 15868 [2001:888:2000:d::a6]:50494 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49131 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