Python module/program

McCann, Brian bmccann at
Thu Jan 27 17:30:32 CET 2011

The python module is currently catching NO exceptions.  There are no try/except blocks.  Right now I just have the module simply printing something and returning "OK" for everything...just as a proof of concept.

Thanks though,

From: at [ at] On Behalf Of Terry Simons
Sent: Wednesday, January 26, 2011 6:07 PM
To: FreeRadius users mailing list
Subject: Re: Python module/program

Is the python module catching all exceptions?

You need to make sure you don't mask out the KeyboardInterrupt exception... otherwise, you may prevent Control-C from being passed up the stack.

I'm not sure if that's your issue, but it sounds like it could be.  It's considered a Python best practice to explicitly catch the exact exceptions that you know how to handle, and let exceptions that you're not going to handle directly trickle up.

That is to say that you should never do something like:

    <some code>
   <some code>

because you *will* end up masking things like KeyboardInterrupt.

You should always do something like:

    <some code>
except TheExceptionClass:
    <some code>


- Terry

On Wed, Jan 26, 2011 at 2:47 PM, McCann, Brian <bmccann at<mailto:bmccann at>> wrote:
Hi all.  I've got freeradius working using a python library for auth, but something interesting happened when I did.  When I run "radius -X", and press  CRTL+C, it no longer exits.  It just returns "Ready to process requests.".  The PID doesn't change, so it's not like its exiting and restarting.

I looked at (yes...I know...perl != python, but as the python page doesn't say much, I'm going on the perl page for a starting point) and it doesn't look like the script has to do anything to handle exits.  Does anyone know what I'm missing?


List info/subscribe/unsubscribe? See

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Freeradius-Users mailing list