From 37f655338a2607d243506847d3ab127422405c1c Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Tue, 5 Mar 2024 18:03:17 +0100 Subject: [PATCH 1/2] Print a nice error of Open3D is not installed --- examples/PointCloud/visualize_pointcloud.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/PointCloud/visualize_pointcloud.py b/examples/PointCloud/visualize_pointcloud.py index 9aa804d2c..3ea338cbe 100644 --- a/examples/PointCloud/visualize_pointcloud.py +++ b/examples/PointCloud/visualize_pointcloud.py @@ -1,9 +1,13 @@ import depthai as dai -import open3d as o3d from time import sleep import numpy as np import cv2 import time +try: + import open3d as o3d +except ImportError: + print("Open3D not installed, to be able to run the example install Open3D with: python3 -m pip install open3d") + exit(1) FPS = 30 class FPSCounter: From 11b925f64bb8c468be7df67706d2680793dbc0af Mon Sep 17 00:00:00 2001 From: Matevz Morato Date: Tue, 5 Mar 2024 18:16:28 +0100 Subject: [PATCH 2/2] Update the handling for uninstalled open3d --- examples/PointCloud/visualize_pointcloud.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/PointCloud/visualize_pointcloud.py b/examples/PointCloud/visualize_pointcloud.py index 3ea338cbe..2ff669491 100644 --- a/examples/PointCloud/visualize_pointcloud.py +++ b/examples/PointCloud/visualize_pointcloud.py @@ -3,11 +3,11 @@ import numpy as np import cv2 import time +import sys try: import open3d as o3d except ImportError: - print("Open3D not installed, to be able to run the example install Open3D with: python3 -m pip install open3d") - exit(1) + sys.exit("Critical dependency missing: Open3D. Please install it using the command: '{} -m pip install open3d' and then rerun the script.".format(sys.executable)) FPS = 30 class FPSCounter: