Re: Too Broad of an exception

2023-10-26 Thread Rene Kita via Python-list
Rene Kita  wrote:
> rsutton  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.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Too Broad of an exception

2023-10-25 Thread Rene Kita via Python-list
rsutton  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.
-- 
https://mail.python.org/mailman/listinfo/python-list