def check_for_error(error_code):
from nidaqmx._lib import lib_importer
if error_code < 0:
error_buffer = ctypes.create_string_buffer(2048)
cfunc = lib_importer.windll.DAQmxGetExtendedErrorInfo
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [ctypes.c_char_p, ctypes.c_uint]
cfunc(error_buffer, 2048)
raise DaqError(error_buffer.value.decode("utf-8"), error_code)
elif error_code > 0:
error_buffer = ctypes.create_string_buffer(2048)
cfunc = lib_importer.windll.DAQmxGetErrorString
if cfunc.argtypes is None:
with cfunc.arglock:
if cfunc.argtypes is None:
cfunc.argtypes = [ctypes.c_int, ctypes.c_char_p,
ctypes.c_uint]
cfunc(error_code, error_buffer, 2048)
warnings.warn(DaqWarning(
error_buffer.value.decode("utf-8"), error_code))
评论列表
文章目录