PyDAQmx icon indicating copy to clipboard operation
PyDAQmx copied to clipboard

No attribute WriteAnalogScalarF64

Open marcodeltutto opened this issue 5 years ago • 2 comments

Hello, I am on macOS with python3, and if I try to run example2.py I get the following error:

Traceback (most recent call last):
  File "PyDAQmx/test.py", line 20, in <module>
    task_out.WriteAnalogScalarF64(1,10.0,value,None)
AttributeError: 'Task' object has no attribute 'WriteAnalogScalarF64'

Any suggestions on how to fix it? Thank you!

marcodeltutto avatar Feb 26 '20 21:02 marcodeltutto

On macOS, you are using the nidaqmxbase driver and not the nidaqmx one. Only a subset of functions are available, and WriteAnalogScalarF64 is not. In your case you should probably put your value in an array and use task.WriteAnalog64

import numpy as np
data = np.array([value])
n=1
sampsPerChanWritten=int32()

task.WriteAnalogF64(n, 0, 10.0, DAQmx_Val_GroupByScanNumber, data, 
     byref(sampsPerChanWritten), None)

clade avatar Feb 27 '20 13:02 clade

Thank you, it works!

marcodeltutto avatar Feb 27 '20 20:02 marcodeltutto