Too Broad of an exception
Rene Kita
mail at rkta.de
Thu Oct 26 05:04:27 EDT 2023
Rene Kita <mail at rkta.de> wrote:
> rsutton <rsutton43 at comcast.net> wrote:
>> Hi all,
>> I am fairly new to python (ie < 2 years). I have a question about
>> pylint. I am running on windows 10/11, python 3.10.11.
> [...]
>> if p.returncode >= 8:
>> raise Exception(f'Invalid result: {p.returncode}')
>>
>> It actually runs fine. But pylint is not having it. I get:
>>
>> win_get_put_tb_filters.py:61:12: W0719: Raising too general exception:
>> Exception (broad-exception-raised)
>
> pylint is just a linter, ignore it if the code works and you like it the
> way it is.
>
> pylint complains because you use Exception. Use e.g. RuntimeException to
> silence it.
^^^^^^^^^^^^^^^^
Ingrid says it's a RuntimeError, not RuntimeException.
More information about the Python-list
mailing list