According to comtypes documentation is is possible to pass numpy arrays to comtypes objects, but how to I pass scalar values, e.g. numpy.float32(1.0)
?
https://pythonhosted.org/comtypes/#numpy-interop
I get following error:
---------------------------------------------------------------------------
ArgumentError Traceback (most recent call last)
<ipython-input-67-9e7e5859c6a5> in <module>()
----> 1 com_obj.Update("string_name",np.float32(6.6e-6))
ArgumentError: argument 2: <type 'exceptions.TypeError'>: Cannot put 6.5999998e-06 in VARIANT
Passing ctypes.c_float
rather than np.float32
will work. e.g. com_obj.Update("string_name", ctypes.c_float(6.6e-6))
.