How to run python files (.py) generated by gnu-radio companion independently (without GRC GUI)?

3.2k views Asked by At

I am trying to run the python file generated by GNU Radio Companion (GRC) without using GRC GUI (from Pycharm IDE). I also set the interpreter accordingly, where the gnu radio has been installed (C:\Program Files\GNURadio-3.8\gr-python27\python.exe). But I am getting this below error still:

    "C:\Program Files\GNURadio-3.8\gr-python27\python.exe" "C:/Users/thangaraj/GNU Radio/AM_Demod.py"
Traceback (most recent call last):
  File "C:/Users/thangaraj/GNU Radio/AM_Demod.py", line 10, in <module>
    from gnuradio import gr
ImportError: No module named gnuradio

Any help will be very much appreciated!

Regards, Thangaraj

1

There are 1 answers

0
Marcus Müller On

The answer to the title

How to run python files (.py) generated by gnu-radio companion independently (without GRC GUI)?

is:

GRC just generates a python script that you can execute. You don't need the GRC UI to execute that at all.


The answer to the question you're asking is:

of course you need GNU Radio as is; you've not set up the paths to the GNU Radio Python modules correctly, which is why Python can't find the gnuradio module, exactly as the error message. You want to look into how the link/script that you use to start GRC does that, especially setting the PYTHONPATH environment variable.