Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77737
| From | Ned Batchelder <ned@nedbatchelder.com> |
|---|---|
| Subject | Re: exit code of a script that raises an Exception? |
| Date | 2014-09-09 11:22 -0400 |
| References | <efb77e4a-0510-49d3-8873-96714632a154@googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.13901.1410276152.18130.python-list@python.org> (permalink) |
On 9/9/14 9:55 AM, thequietcenter@gmail.com wrote: > Hello, after looking at the docs for Exception: > https://docs.python.org/2/library/exceptions.html > > I do not see any information on the guaranteed exit code a script that exits because Python threw an exception. > > I wonder if all exceptions throw the exact same non-zero exit code, or whether a specific exit code is assigned to each exception uniquely. Or whether the exit code behavior is undefined (especially since it appears to be undocumented). > > Thanks, > Terrence > A quick check demonstrates that exceptions do not get distinct status codes. BTW: how could they?, you can create new exception types, there is not a bounded number of them. On my Mac, Python 2.7 exited with a status code of 1 for ZeroDivisionError, NameError, SyntaxError, IndexError, and KeyError. -- Ned Batchelder, http://nedbatchelder.com
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
exit code of a script that raises an Exception? thequietcenter@gmail.com - 2014-09-09 06:55 -0700 Re: exit code of a script that raises an Exception? thequietcenter@gmail.com - 2014-09-09 07:41 -0700 Re: exit code of a script that raises an Exception? Ned Batchelder <ned@nedbatchelder.com> - 2014-09-09 11:22 -0400
csiph-web