Search code examples
pythonwindowsdata-acquisition

Failed to import ul from mcculw


Here's how I tried to import MCC Universal Library Python API for Windows:

import ctypes
from mcculw import ul
from mcculw.enums import InterfaceType

As a reward, here's the error that Python tossed at me:

  File "yadayada.py", line 12, in <module>
    from mcculw import ul
  File "D:\Python27\lib\site-packages\mcculw\ul.py", line 39, in <module>
    _cbw.cbAChanInputMode.argtypes = [c_int, c_int, c_int]
  File "D:\Python27\lib\ctypes\__init__.py", line 378, in __getattr__
    func = self.__getitem__(name)
  File "D:\Python27\lib\ctypes\__init__.py", line 383, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'cbAChanInputMode' not found

I must admit that I've had the honour to witness error messages that have been somewhat more self-explanatory than that.


Solution

  • I had just installed mcculw via pip, but the last time I updated the MCC DLLs was several years ago. Clicked my way to https://www.mccdaq.com/Software-Downloads.aspx, downloaded the most recent MCC DAQ CD package, installed it and everything worked happily ever after.

    TL;DR: Update your MCC DAQ software.