From 3077bbea252c62e8abf825ad11bf5118d79a2ba3 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Tue, 1 Mar 2022 10:34:03 +0100 Subject: Add Python error handling to video_images_get If for any reason the data stream from the camera is no longer available, without these checks the entire python interpreter crashes with a nice segmentation fault. These checks allow to handle the error from within Python with something like: try: o3000.video_images_get() except RuntimeError: ... restart o3000 driver Also, there is a change in the compilation flags to show more (useful) warnings, i.e. -Wall and hide the "unused variable" warning. --- setup_c_extension.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setup_c_extension.py') diff --git a/setup_c_extension.py b/setup_c_extension.py index e01837f..f1f3e08 100644 --- a/setup_c_extension.py +++ b/setup_c_extension.py @@ -12,5 +12,5 @@ setup(name = 'o3000', version = '1.0', sources = ['c_extension.c', 'helpers.c'], libraries = ['o3000', 'o3000_imgpipe', 'tiff'], include_dirs = [str(numpy_headers_path)], - # extra_compile_args = ['-Wextra'] + extra_compile_args = ['-Wextra', '-Wall', '-Wno-unused-parameter'] )]) -- cgit v1.2.1