WindowsError: exception: access violation writing 0x00000000
Sparky
Samnsparky at gmail.com
Tue Aug 4 11:25:28 EDT 2009
On Aug 3, 3:29 pm, Sparky <Samnspa... at gmail.com> wrote:
> Hello! I am using cTypes on Windows to interface with a dll and I keep
> getting an error when I execute this method:
>
> def eDigitalIn(self, channel, idNum = None, demo = 0, readD=0):
> """
> Name: U12.eAnalogIn(channel, idNum = None, demo = 0, readD=0)
> Args: See section 4.4 of the User's Guide
> Desc: This is a simplified version of Counter. Reads & resets
> the counter (CNT).
> """
>
> if idNum is None:
> idNum = self.id
>
> ljid = ctypes.c_long(idNum)
> state = ctypes.c_long(999)
>
> ecode = staticLib.ECount(ctypes.byref(ljid), demo, channel,
> readD, ctypes.byref(state))
>
> if ecode != 0: raise LabJackException(ecode)
> if ljid == -1: raise LabJackException(-1, "LabJack not
> found.")
>
> return {"idnum":ljid.value, "state":state.value}
>
> Here is the error message:
> Traceback (most recent call last):
> File "<pyshell#4>", line 1, in <module>
> device.eDigitalIn(0)
> File "C:\Documents and Settings\All Users\Documents\Python
> \LabJackPython_new\u12.py", line 118, in eDigitalIn
> ecode = staticLib.ECount(ctypes.byref(ljid), demo, channel, readD,
> ctypes.byref(state))
> WindowsError: exception: access violation writing 0x00000000
>
> Here is the signature of the method (which is known to work with C++
> programs):
>
> long _stdcall EDigitalIn(long *idnum,
> long demo,
> long channel,
> long readD,
> long *state);
>
> staticLib is declared with staticLib = ctypes.windll.LoadLibrary
> ("ljackuw").
>
> Any ideas?
>
> Thanks,
> Sam
One more thing, I seem to be getting back incorrect values for doubles
passed by reference. Any suggestions? I am on a 64-bit machine but I
should think that should not make a difference.
Thanks again,
Sam
More information about the Python-list
mailing list