# Catching UHD errors in Python

**URL:** <https://www.ruby-forum.com/t/catching-uhd-errors-in-python/219404>\
**Category:** GNU Radio\
**Created:** [May 2, 2012, 3:45am UTC](https://www.ruby-forum.com/t/catching-uhd-errors-in-python/219404 "2012-05-02T03:45:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 2, 2012, 3:45am UTC](https://www.ruby-forum.com/t/catching-uhd-errors-in-python/219404/1 "2012-05-02T03:45:37Z")

</div>

Is there a good way to catch UHD errors in Python? I will look into  
gr\_async\_msg\_source for handling L’s, O’s, U’s, and S’s, but how does  
one catch UHD runtime errors such as if the Ethernet cable gets  
disconnected from an N200? UHD docs describe registering a handler  
method but has this functionality been swigged into GNU radio?

Would it make sense to define a handler function in  
gr\_uhd\_usrp\_{sink|source}?

Respectfully,  
Sean Nowlan

---

<div class="post-metadata">

**Author:** ![NowlanS\_Sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f05b48/32.png) [@NowlanS\_Sean](https://www.ruby-forum.com/u/NowlanS_Sean)\
**Post date:** [May 2, 2012, 4:33pm UTC](https://www.ruby-forum.com/t/catching-uhd-errors-in-python/219404/2 "2012-05-02T16:33:13Z")

</div>

Will try “try” “catch”… this very well may have been a dumb question.  
I blame it on lack of sleep.

* * *

From: discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid  
[discuss-gnuradio-bounces+sean.nowlan=removed\_email\_address@domain.invalid] on behalf  
of Nowlan, Sean [removed\_email\_address@domain.invalid]  
Sent: Tuesday, May 01, 2012 9:44 PM  
To: removed\_email\_address@domain.invalid  
Subject: [Discuss-gnuradio] catching UHD errors in Python

Is there a good way to catch UHD errors in Python? I will look into  
gr\_async\_msg\_source for handling L’s, O’s, U’s, and S’s, but how does  
one catch UHD runtime errors such as if the Ethernet cable gets  
disconnected from an N200? UHD docs describe registering a handler  
method but has this functionality been swigged into GNU radio?

Would it make sense to define a handler function in  
gr\_uhd\_usrp\_{sink|source}?

Respectfully,  
Sean Nowlan

---

<div class="post-metadata">

**Author:** ![NowlanS\_Sean](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/f05b48/32.png) [@NowlanS\_Sean](https://www.ruby-forum.com/u/NowlanS_Sean)\
**Post date:** [May 2, 2012, 6:17pm UTC](https://www.ruby-forum.com/t/catching-uhd-errors-in-python/219404/3 "2012-05-02T18:17:44Z")

</div>

On 05/01/2012 06:44 PM, Nowlan, Sean wrote:

> Is there a good way to catch UHD errors in Python? I will look into  
> gr\_async\_msg\_source for handling L’s, O’s, U’s, and S’s, but how does  
> one catch UHD runtime errors such as if the Ethernet cable gets  
> disconnected from an N200? UHD docs describe registering a handler  
> method but has this functionality been swigged into GNU radio?

Hasnt been swigged. This would be neat because the errors could pop up  
in a little message window in the GUI.

> Would it make sense to define a handler function in  
> gr\_uhd\_usrp\_{sink|source}?

No. Its more of a global process thing, rather than a per instance.

This is basically a swig directors use case, and there isnt any public  
header c++ header stuff to expose. You are basically looking at a custom  
handler in the .i file,  
and a little routine in the init.py

I’m not in a state of implementing it right now, but if you want some  
inspiration, the python blocks code uses the existing gnuradio swig  
director stuff, you should take a look:

See use of feval in cc and h, py file

> <https://github.com/guruofquality/grextras/blob/master/lib/block_gateway.h#L98>

> <https://github.com/guruofquality/grextras/blob/master/python/block_gateway.py#L45>

-josh
