I have the following code:
try:
self._collect_persons_status()
except manager.AsteriskManagerError:
# If it is not possible to continue with the collection of initial
# person statuses via Asterisk Manager, end the program with an
# error code.
logger.debug('*** exit with 1!!')
sys.exit(1)
This script is handled via systemd (runs as a daemon with a loop).
From the log I can see that *** exit with 1!! is printed, but the script ends with code 0, not 1 as expected:
What am I doing wrong?

try: <invoke script entry point> except: <log error>at the script top-level?