AnsweredAssumed Answered

iio.Buffer() returns error in Python

Question asked by dmercer Employee on Jul 24, 2017
Latest reply on Aug 1, 2017 by larsc


I'm writing a short Python program to both test and learn how to use iio with the M2K. Many of the functions seem to work as expected until I try to create a device buffer using iio.Buffer(). My test program tries to create a buffer as the last thing and it returns the following error:


Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:19:22) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
RESTART: C:\Users\Doug\Documents\RPI\ADiscovery\ALM\libiio-test\
Library version: 0.10 (git tag: c95ff6a)
DAC1 readback: 0.000000
DAC2 readback: 0.000000
ADC0 readback: 1672.656250
ADC1 readback: 0.001563
ADC2 readback: 0.003125
ADC3 readback: 665.625000
ADC4 readback: 706.250000
ADC5 readback: 1381.250000
m2k_dac_a = <iio.Device object at 0x02B13490>
dac_a0 = <iio.Channel object at 0x02B1A110>

Traceback (most recent call last):
File "C:\Users\Doug\Documents\RPI\ADiscovery\ALM\libiio-test\", line 76, in <module>
dac_a_buff = iio.Buffer(m2k_dac_a, 4096, True)
File "C:\Users\Doug\Documents\RPI\ADiscovery\ALM\libiio-test\", line 516, in __init__
self._buffer = _create_buffer(device._device, samples_count, cyclic)
File "C:\Users\Doug\Documents\RPI\ADiscovery\ALM\libiio-test\", line 33, in _checkNull
raise OSError(err, _strerror(err))
OSError: [Errno 6] No such device or address


It seems to return the same error for any and all of the M2K devices. What am I dong wrong? It there some step I have to do first before creating the buffer? Test program attached.