The method versions in the Task class of the DAQmx functions don't return, which is generally OK, since PyDAQmx already takes care of errors or warnings, but that doesn't allow to get the size of the buffer for functions with data and bufferSize via catch_error_buffer.
Therefore is more an issue of consistency, since if one changes code to the object oriented interface, it could be confusing to found that the behaviour changes. I don't know if a modification so the methods return the error code could generate issues downstream, but since right now they not return (return None) I don't really see any issues if that changes:
for function_name in task_function_list:
name = function_name[5:] # remove the DAQmx in front of the name
func = getattr(DAQmxFunctions, function_name)
arg_names = function_dict[function_name]['arg_name']
doc = 'T.%s(%s) -> error.' %(name, ', '.join(arg_names[1:]))
cmd = """def {0}(self, {1}):
"{3}"
return {2}(self.taskHandle, {1})"""
exec(cmd.format(name, ', '.join(arg_names[1:]), function_name, doc))
instead of the current:
for function_name in task_function_list:
name = function_name[5:] # remove the DAQmx in front of the name
func = getattr(DAQmxFunctions, function_name)
arg_names = function_dict[function_name]['arg_name']
doc = 'T.%s(%s) -> error.' %(name, ', '.join(arg_names[1:]))
cmd = """def {0}(self, {1}):
"{3}"
{2}(self.taskHandle, {1})"""
exec(cmd.format(name, ', '.join(arg_names[1:]), function_name, doc))
The method versions in the Task class of the DAQmx functions don't return, which is generally OK, since PyDAQmx already takes care of errors or warnings, but that doesn't allow to get the size of the buffer for functions with
data
andbufferSize
viacatch_error_buffer
.So both versions don't have the same behaviour, but if we give the buffer, both fill it properly:
Therefore is more an issue of consistency, since if one changes code to the object oriented interface, it could be confusing to found that the behaviour changes. I don't know if a modification so the methods return the error code could generate issues downstream, but since right now they not return (return
None
) I don't really see any issues if that changes:instead of the current: