Access Violation Error while using Python Ctypes

Discussion in 'Python' started by HighBeliever, Jul 4, 2013.

  1. HighBeliever

    HighBeliever Guest

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

    from ctypes import *

    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')


    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\", line 49, in <module>
    File "C:\Users\KURO\Desktop\hunspell\", line 17, in __init__
    self.hunhandle = hunspell.HunspellInit('en_US.aff', 'en_US.dic')
    WindowsError: exception: access violation reading 0x0000000001FBB000

    Please help me out.
    HighBeliever, Jul 4, 2013
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.