Run a python script interactively from GNU Radio

2024-07-03 Thread Elmore Family
I have an application which I can run successfully as a standalone Python 
script called from the terminal. When executed, this script is in a while loop.

I would like to execute the script from GNU Radio and interact with it. I have 
a toggle button which when pressed calls the script. Once the script begins 
execution I no longer have control from GNU Radio – the window does not 
respond. I realize this is because the script is in a while loop without any 
way to exit it (another issue).

Is there some way to run this script and still have a functioning GNU Radio? I 
would like to be able to exit the script, enter a value to be used by the 
script, set other parameters, etc. Is this possible or am I attempting to do 
something which is not within GNU Radio’s purview?

This is a fairly complex project I have been working on for some time but this 
is the first time I tried something like this. I don’t want to have to build 
all the OOTs that would be required to run this entirely in GNU Radio. It was 
difficult enough to develop a successfully executing script.

Jim

--
This email has been checked for viruses by AVG antivirus software.
www.avg.com

Run a python script interactively from GNU Radio

2024-07-03 Thread Steve Hageman
Hello Elmore - The normal route to control variables in a running GNU 
Radio script is via the XMLRPC Server.


It is usually run like this,

   * Start GNU Radio (which includes a XMLRPC server block)

   * Start the standalone Python script that connects to the XMLRPC
   Server opened in the GNU Radio Flow.

Then the standalone Python script can control the running GNU Radio flow 
graphs,


   * The server provides access to the run, start, stop, wait functions
   of the flow graph.

   * The server also provides access to the variable callbacks in the
   flow graph. Ex: If the variable is called freq, the function
   provided by the server will be called set_freq(new_freq).

documentation page: https://wiki.gnuradio.org/index.php/XMLRPC_Server


Hope This Helps - Steve Hageman


RE: [EXTERNAL] Run a python script interactively from GNU Radio

2024-07-03 Thread Jim Melton
Jim,

This really has little to do with GNU Radio and more to do with Python/GUI 
concurrency.

As a general rule, a GUI should never perform a “blocking” operation. Since 
your application has its own “event loop”, it is fatal to pass control to it 
from another event loop.

Rather than calling your application directly, consider the Python 
subprocess module. Stack 
Overflow
 is helpful.

---
Jim Melton

From: discuss-gnuradio-bounces+jim.melton=sncorp@gnu.org 
 On Behalf Of Elmore 
Family
Sent: Wednesday, July 3, 2024 10:05
To: GNU Radio 
Subject: [EXTERNAL] Run a python script interactively from GNU Radio

You don't often get email from wa4...@comcast.net. 
Learn why this is important
DO NOT click on links. Never open an email attachment unless you're 100% sure 
it's from a trusted source and you are expecting it.


I have an application which I can run successfully as a standalone Python 
script called from the terminal. When executed, this script is in a while loop.

I would like to execute the script from GNU Radio and interact with it. I have 
a toggle button which when pressed calls the script. Once the script begins 
execution I no longer have control from GNU Radio – the window does not 
respond. I realize this is because the script is in a while loop without any 
way to exit it (another issue).

Is there some way to run this script and still have a functioning GNU Radio? I 
would like to be able to exit the script, enter a value to be used by the 
script, set other parameters, etc. Is this possible or am I attempting to do 
something which is not within GNU Radio’s purview?

This is a fairly complex project I have been working on for some time but this 
is the first time I tried something like this. I don’t want to have to build 
all the OOTs that would be required to run this entirely in GNU Radio. It was 
difficult enough to develop a successfully executing script.

Jim

[https://s-install.avcdn.net/ipm/preview/icons/icon-envelope-tick-green-avg-v1.png]
Virus-free.www.avg.com

CONFIDENTIALITY NOTICE - SNC EMAIL: This email and any attachments are 
confidential, may contain proprietary, protected, or export controlled 
information, and are intended for the use of the intended recipients only. Any 
review, reliance, distribution, disclosure, or forwarding of this email and/or 
attachments outside of Sierra Nevada Company, LLC. (SNC) without express 
written approval of the sender, except to the extent required to further 
properly approved SNC business purposes, is strictly prohibited. If you are not 
the intended recipient of this email, please notify the sender immediately, and 
delete all copies without reading, printing, or saving in any manner. --- Thank 
You.