petersbingham / dae-py-relay-controller

Python code for controlling Denkovi usb relay boards.
https://denkovi.com/
14 stars 14 forks source link

Arithmetic over flow in Iron Python #1

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago

Hello Peter,

I would like to extend my thanks for the great work you’ve done with 
integrating the DAE Relay board with Python. I t made easy work for me.

One bit of feedback I would like to give concerns FTD2XXDllWrap.py line 107

I use both Python and IronPython interpreters.

For some reason when using the IronPython interpreter I received an arithmetic 
overflow in GetNumDevices

    def FT_GetNumDevices(self):

        numDevs = c_int()

        ret = self.FTD2XXDLL.FT_ListDevices(pointer(numDevs), None, FT_LIST_NUMBER_ONLY)

        return (ret, numDevs.value)

However, I discovered that by simply changingit  to use FT_CreateDeviceInfoList 
it now works fine for both Pyhton 2.7 and Iron Python 2.7 interpreters.

    def FT_GetNumDevices(self):

        numDevs = c_int()

        ret = self.FTD2XXDLL.FT_CreateDeviceInfoList(byref(numDevs))

        return (ret, numDevs.value)

Again, thanks for the great work.

Cheers,

Bill

Original issue reported on code.google.com by DavesSta...@gmail.com on 7 Jul 2015 at 1:57