Iterating over gain ranges with python

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/osmocom-sdr@lists.osmocom.org/.

Christian Gagneraud chris at techworks.ie
Sun Aug 5 19:10:54 UTC 2012


Hi there,

In a python script, I would like to iterate over things like 
get_gain_names, get_gain_ranges, ...

The problem is that these functions return a std::vector<std::string> *.
The error i get is: TypeError: 'SwigPyObject' object is not iterable

It would be very nice to be able to do something like:
for src.get_sample_rates():
    # do something
for name in get_gain_names():
    # do smth

I found this: http://reference-man.com/files/generators.i
But i haven't been able to use it so far. :(

Any help or comments appreciated.

Chris


-- 
Christian Gagneraud,
Embedded systems engineer.
Techworks Marine
1 Harbour road
Dun Laoghaire
Co. Dublin
Ireland
Tel: + 353 (0) 1 236 5990
Web: http://www.techworks.ie/




More information about the osmocom-sdr mailing list