py: cam.py: Exit on exception
Catch exceptions in the event_handler, as they would get ignored otherwise. Print the exception and return False so that the main loop exits. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
7ac7e0e119
commit
1384cedf50
1 changed files with 14 additions and 9 deletions
|
@ -11,6 +11,7 @@ import binascii
|
||||||
import libcamera as libcam
|
import libcamera as libcam
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
|
|
||||||
|
|
||||||
class CustomAction(argparse.Action):
|
class CustomAction(argparse.Action):
|
||||||
|
@ -286,6 +287,7 @@ def capture_start(contexts):
|
||||||
|
|
||||||
# Called from renderer when there is a libcamera event
|
# Called from renderer when there is a libcamera event
|
||||||
def event_handler(state):
|
def event_handler(state):
|
||||||
|
try:
|
||||||
cm = state['cm']
|
cm = state['cm']
|
||||||
contexts = state['contexts']
|
contexts = state['contexts']
|
||||||
|
|
||||||
|
@ -299,6 +301,9 @@ def event_handler(state):
|
||||||
|
|
||||||
running = any(ctx['reqs-completed'] < ctx['opt-capture'] for ctx in contexts)
|
running = any(ctx['reqs-completed'] < ctx['opt-capture'] for ctx in contexts)
|
||||||
return running
|
return running
|
||||||
|
except Exception as e:
|
||||||
|
traceback.print_exc()
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
def request_handler(state, ctx, req):
|
def request_handler(state, ctx, req):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue