Python module/program

Terry Simons terry.simons at gmail.com
Thu Jan 27 00:06:58 CET 2011


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:

try:
    <some code>
except:
   <some code>

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

You should always do something like:

try:
    <some code>
except TheExceptionClass:
    <some code>

HTH,

- Terry

On Wed, Jan 26, 2011 at 2:47 PM, McCann, Brian <bmccann at andmore.com> 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 http://wiki.freeradius.org/Rlm_perl (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?
>
> Thanks,
> --Brian
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/users.html
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20110126/70e696f4/attachment.html>


More information about the Freeradius-Users mailing list