Without the cast, I got this traceback when data was a numpy.uint16:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/wking/.python/unfold.py", line 101, in __init__
self.zp.jumpToPos(self.zp.pos_nm2out(0))
File "/home/wking/.python/z_piezo.py", line 161, in jumpToPos
self.curIn = self._jump.jumpToPos(self.curOut)
File "/home/wking/.python/z_piezo.py", line 248, in jumpToPos
self.AO.write(out)
File
"/home/wking/lib/python2.5/site-packages/pycomedi-0.1-py2.5.egg/pycomedi/single_aio.py",
line 90, in write
self.write_chan_index(i, data[i])
File
"/home/wking/lib/python2.5/site-packages/pycomedi-0.1-py2.5.egg/pycomedi/common.py",
line 411, in write_chan_index
rc = c.comedi_data_write(self.dev, self.subdev,
self.chan[chan_index], self._range[chan_index], self._aref[chan_index],
data);
TypeError: in method 'comedi_data_write', argument 6 of type 'lsampl_t'
"""
if self.output != True :
raise pycomediError, "Must be an output to write"
- rc = c.comedi_data_write(self.dev, self.subdev, self.chan[chan_index], self._range[chan_index], self._aref[chan_index], data);
+ rc = c.comedi_data_write(self.dev, self.subdev, self.chan[chan_index],
+ self._range[chan_index],
+ self._aref[chan_index], int(data));
if rc != 1 : # the number of samples written
self._comedi.comedi_perror("comedi_data_write")
raise pycomediError, "comedi_data_write returned %d" % rc