Sunday, July 14, 2024

How to configure an external editor for Embedded Python Blocks in GNURadio Companion under Windows

Under Windows, it is difficult to set a default editor for editing Python Blocks GNU Radio Companion. This is because the GUI element that leads to the editor selecton does not work very well under Windows (it seems to work well under LINUX however - go figure!?)

When you press the button “Choose Editor,” the basic problem arises as you encounter a nonsensical list of apps that have no relevance to editing and you cannot browse for an alternative.


Alternative Method

If you then the GNU Radio documentation you will probably find a page that says there is a file called “config.conf” and in this file there is a section called “[grc]”, adding a line after this heading that says something like,

editor = [full path to your editor here]

and now you will have to set your editor the hard way, but you can do it to overcome the lack of proper dialog boxes.


Where’s Waldo?

Trouble is, it is difficult to find config.conf on Windows systems, here is how to do it.

Note: Some of these paths might be different depending on exactly how you installed Radioconda. This is how it installed on my system.

Open a command window at,

C:\Users\steve\radioconda\Scripts

(Or where ever you find a ‘conda.exe’ in your Radioconda install)

Now run the command,

conda info –envs

This will tell you what environments are available. In my case, it reports ‘base’

In the same command window, type:

conda activate base

To find the userprefsdir type:

gnuradio-config-info –userprefsdir

In my case this reports:

C:\SPB_Data\.gnuradio

This is the directory where you will find the file "config.conf".

 

Hardcoding an Editor

Open the file config,conf and look for a section titled:

[grc]

If it does not exist, then make it.

After this section, add a line something like:

editor = C:\Users\steve\AppData\Local\Programs\Microsoft VS Code\Code.exe

In the example above, I hardcoded Visual Studio Code as my Python Block Editor. You should be able to add any editor you like as long as you list the full path to the EXE file.

 

Clean up

After you set the editor be sure to deactivate the Conda Virtual Environment by using the command,

conda deactivate

 

Bonus

Another useful directory location is the 'Preferences directory' or 'conf.d' as you will find mentioned in some of the documentation. 
 
 
To find this directory location type,

gnuradio-config-info –prefsdir
 
In my case this reports,

C:\Users\steve\radioconda\Library\etc\gnuradio\conf.d
 

Applies To

GNU Radio Companion installed by Radioconda 2024 (GNU Radio version 3.10.10)

Windows 10 or 11 


Acknowledgement

Thanks to Marcus Muller, for pointing me to the existence of the gnuradio-config-info script.


No comments:

Post a Comment