Interesting discovery from automatic tools (python code)
José Matos
jaomatos at gmail.com
Thu Aug 11 22:08:45 UTC 2022
On Thu, 2022-08-11 at 20:29 +0200, Pavel Sanda wrote:
> > I did not use the exceptions to understand the failure reasons.
> > The issue with the except is that it is a catch all option and so
> > the
> > exception could be caused by faulty assumptions from us in the
> > initial
> > code.
>
> My understanding is that subprocess.check_call does not return
> nonzero
> to signal nonzero exit status of the called subroutine, but raises
> exception. So the correct thing is to catch exception, not checking
> return value of subprocess.check_call. (?)
>
> Pavel
You are right. :-)
My point is that for the code to be correct we should catch the right
exception: subprocess.CalledProcessError. This is valid even for python
2.
Being practical your solution works so commit it. :-)
--
José Abílio
More information about the lyx-devel
mailing list