Gnuradio companion Generation error: NameError

Generating: ‘/root/CRUX/rx_gui/’
Generate Error: (NameError(“‘i’ is not defined”,), ‘<%\n all_options = [ option0, option1, option2, option3, option4 ][:int(num_opts)]\n all_labels = [ label0, label1, label2, label3, label4 ][:int(num_opts)]\n%>\\n# Create the options list\n% if int(num_opts):\nself.${id}options = (\\n% for ch in all_options:\n${ch}, \\n% endfor\n)\n% else:\nself.${id}options = ${options}\n% endif\n# Create the labels list\n% if int(num_opts):\nself.${id}labels = (\\n% for lbl in all_labels:\n% if lbl:\n${lbl}, \\n% else:\nself.${id}options[${i}], \\n% endif\n% endfor\n)\n% elif labels:\nself.${id}labels = ${labels}\n% else:\nself.${id}map(str, self.${id}options)\n% endif\n# Create the combo box\n% if widget == 'combo_box':\n<%\n win = 'self.%s_tool_bar'%id\n%>\\n${win} = Qt.QToolBar(self)\n${win}.addWidget(Qt.QLabel(${(label if (len(label) - 2 > 0) else repr(id))} + ": "))\nself.${id}combo_box = Qt.QComboBox()\n${win}.addWidget(self.${id}combo_box)\nfor label in self.${id}labels: self.${id}combo_box.addItem(label)\nself.${id}callback = lambda i: Qt.QMetaObject.invokeMethod(self.${id}combo_box, “setCurrentIndex”, Qt.Q_ARG(“int”, self.${id}options.index(i)))\nself.${id}callback(self.${id})\nself.${id}combo_box.currentIndexChanged.connect(\n lambda i: self.set${id}(self.${id}options[i]))\n% endif\n# Create the radio buttons\n% if widget == 'radio_buttons':\n<%\n win = 'self.%s_group_box'%id\n%>\\n${win} = Qt.QGroupBox(${(label if (len(label) - 2 > 0) else repr(id))} + ": ")\nself.${id}box = ${orient}()\nclass variable_chooser_button_group(Qt.QButtonGroup):\n def init(self, parent=None):\n Qt.QButtonGroup.init(self, parent)\n @pyqtSlot(int)\n def updateButtonChecked(self, button_id):\n self.button(button_id).setChecked(True)\nself.${id}button_group = variable_chooser_button_group()\n${win}.setLayout(self.${id}_box)\nfor i, label in enumerate(self.${id}labels):\n radio_button = Qt.QRadioButton(label)\n self.${id}box.addWidget(radio_button)\n self.${id}button_group.addButton(radio_button, i)\nself.${id}callback = lambda i: Qt.QMetaObject.invokeMethod(self.${id}button_group, “updateButtonChecked”, Qt.Q_ARG(“int”, self.${id}options.index(i)))\nself.${id}callback(self.${id})\nself.${id}button_group.buttonClicked[int].connect(\n lambda i: self.set${id}(self.${id}_options[i]))\n% endif\n${gui_hint() % win}’)


Executing: /usr/bin/python3.6 -u /root/CRUX/rx_gui/

File “/root/CRUX/rx_gui/”, line 18

Yeah, I am singularly unimpressed with the errors GRC generates. I usually find these sort of errors indicated two Qt GUI elements have the same UI hint, and thus are trying to be placed into the same point in the UI. Rather than sensibly detecting this and saying “Component foobarbaz is being placed into the same location (1,0,1,1) as component narfpoitzort.”, you get this sort of barf.
Check where your UI elements are being placed.

Thaanks for your reponse.

I have no idea what are the UI elements, where to find them. I do not what should I change

Where did you get the flow graph? Did you download it?
The UI elements are anything with “Qt” in the name, e.g. Qt edit box. There should be a property labels “UI Hint”, and it will usually contain something like 4 numbers, “1,0,1,1” for example. Make sure all the UI elements have different values for that UI Hint.


I downloaded it from

I also tried an example which gets stored in a computer when installing gnuradio/bladerf. I have checked the UI hint property of the blocks, but and they are all different. So this is not the cause of the error. Will you please run this example and see if you will get the same error?


Well, since I don’t have the BladeRF hardware I cannot run it, but I can compile it to Python without errors.
What version of GRC do you have? I have, perhaps you have an older version?

I met the same error, did you solve it?


I am also using version with python 3.6.9. on ubuntu 18.04

After launching gnuradio-companion,I get the following warnings;

root@comms-NUC8i5BEH:~/SdrSoftware# gnuradio-companion

(gnuradio-companion:15985): GLib-GIO-CRITICAL **: 21:42:10.771: g_dbus_proxy_new_sync: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed
<<< Welcome to GNU Radio Companion >>>

Block paths:

Loading: “/root/FM_Rec_Download/bladeRF_error.grc”

Converting from XML
/usr/lib/python3.6/importlib/ ImportWarning: can’t resolve package from spec or package, falling back on name and path
return f(*args, **kwds)

I have not yet, I am still busy trying