Getting IQ Stream from Heimdall in Python

I am currently trying to get the IQ stream from the Heimdall in Python on a Raspberry Pi for a custom application. I have installed the heimdall_daf_fw from source, installed gnuradio, and installed gr-krakensdr from source. I made a simple script to attempt to connect with the KrakenSDR that is as follows:

import traceback
from gnuradio import gr, krakensdr

try:
    source = krakensdr.krakensdr_source("127.0.0.1",5000,5001,5,1575.42,[30.0] * 5,True)
    print("KrakenSDR source initialized successfully")

except Exception:
    traceback.print_exc()

When I run this, however, I get the following error:

admin@hostname:~ $ python test.py
Sending control message
Successful
Control interface communication finished
Reconfiguration succesfully finished
Sending control message
Control interface communication finished
Reconfiguration succesfully finished
Sending control message
Control interface communication finished
Reconfiguration succesfully finished
Failed to put IQ Samples into the Queue
Exception:

What is causing this error, and how should I be going about getting the IQ data directly from the Heimdall? For reference, the KrakenSDR does work when using the Web UI and I am able to see the waterfall for all 5 channels.

I think your script is never reading the data because it’s not in a flowgraph. Your block is creating the connection, but never running work() as part of a flowgraph, and so the the queue is never emptied and it eventually overflows.

Carl is right: creating the block outside a flowgraph means GNU Radio never schedules work(), so nothing drains the IQ queue. Put the source in a gr.top_block and connect its output to a sink, for example a custom sink block or blocks.vector_sink_c if you only need buffered samples, then start/run the top block. For continuous processing, use a sink block whose work() consumes the complex samples rather than just constructing the source and expecting it to stream.