Too Broad of an exception

rsutton rsutton43 at comcast.net
Wed Oct 25 11:49:12 EDT 2023


On 10/25/2023 11:06 AM, Stefan Ram wrote:
> ram at zedat.fu-berlin.de (Stefan Ram) writes:
>> outer quotation marks) prints some prominent exception types. After
>> manually removing those that do not seem to apply, I am left with:
>> "AssertionError",
>> "ChildProcessError",
> ...
> 
>    "Manually removing" above was meant to be a fast first pass,
>    where I only excluded exception types that were obviously
>    inappropriate. It is now to be followed by a search for the
>    appropriate exception types among those exception types left.
> 
> 
@Rene & @Stefan,
I really appreciate the guidance provided.  By replacing Exception with 
RuntimeError, pylint seems happy!  More specificity, I guess.  I know 
that I could have ignored the pylint exceptions, but I want to use this 
as a learning experience.  I looks like I have a lot of reading to do on 
exception handling. IMO all of the try/except code looks quite clumsy to 
me.  It may be excellent for some tasks but to me, it looks quite 
inelegant.  Like I said, I have a lot to learn.

Thank you both for your guidance.

Richard



More information about the Python-list mailing list