Access Violation Error while using Python Ctypes

H

HighBeliever

I used the following code to import the functions of a dll in my Python code.

from ctypes import *

hunspell=CDLL('C:\Nhunspell\Hunspellx64.dll')
hunspell.HunspellInit.restype = POINTER(c_int)
hunspell.HunspellInit.argtypes = (c_char_p, c_char_p)
hunspell.HunspellSpell.argtypes = (POINTER(c_int), c_char_p)
hunspell.HunspellAdd.argtypes = (POINTER(c_int), c_char_p)
hunspell.HunspellSuggest.argtypes = (POINTER(c_int), POINTER(POINTER(c_char_p)), c_char_p)

class Hunspell(object):
def __init__(self):
self.hunhandle = hunspell.HunspellInit('en_US.aff', 'en_US.dic')

a=Hunspell()

The class Hunspell should act as a wrapper for the function, but then I get this error when I try to run this.

Traceback (most recent call last):
File "C:\Users\KURO\Desktop\hunspell\text.py", line 49, in <module>
a=Hunspell()
File "C:\Users\KURO\Desktop\hunspell\text.py", line 17, in __init__
self.hunhandle = hunspell.HunspellInit('en_US.aff', 'en_US.dic')
WindowsError: exception: access violation reading 0x0000000001FBB000

Please help me out.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top