Exceptions versus Windows ERRORLEVEL

Stephen Tucker stephen_tucker at sil.org
Mon Apr 6 05:04:41 EDT 2020


Thanks, Eryk - this is very helpful.

Stephen.

On Mon, Apr 6, 2020 at 6:43 AM Eryk Sun <eryksun at gmail.com> wrote:

> On 4/3/20, Stephen Tucker <stephen_tucker at sil.org> wrote:
> >
> > Does an exception raised by a Python 3.x program on a Windows machine set
> > ERRORLEVEL?
>
> ERRORLEVEL is an internal state of the CMD shell. It has nothing to do
> with Python. If Python exits due to an unhandled exception, the
> process exit code will be 1. If CMD waits on the process, it will set
> the ERRORLEVEL based on the exit code. But CMD doesn't always wait. By
> default its START command doesn't wait. Also, at the interactive
> command prompt it doesn't wait for non-console applications such as
> "pythonw.exe"; it only waits for console applications such as
> "python.exe".
>


More information about the Python-list mailing list