'simple python module in gnuradio fails "Expression None is invalid for type 'real'"
I have a simple python module to iterate over a few frequencies in a list. For me this should be simple but it's not working within grc.
Expression None is invalid for type 'real'
If I run the module manually it returns f as expected. Within grc the flow fails. If I simply return a frequency, it also works.
What did I miss here?
# this module will be imported in the into your flowgraph
fc = [438100000, 438200000]
fs = len(fc)
i = 1
f = fc[i]
def sweeper(prob_lvl):
global fc, fs, i
if prob_lvl:
f = fc[i]
i += 1
if i == fs:
i = 1
# return int('438000000') ### this works
return int(f) ### this doesnt (block says: Expression None is invalid for type 'real')
Solution 1:[1]
Lesson learned: don't use globals
If you use globals, don't forget to include everything needed, "f" in this case.
running gnuradio-companion --log debug helps
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Andy Schi |
