From daeb81f13420e57105e4fdb9f32ffbf9e7bc8384 Mon Sep 17 00:00:00 2001 From: haosenwang1018 Date: Wed, 25 Feb 2026 02:45:30 +0000 Subject: [PATCH] fix: replace 8 bare excepts with except Exception across 5 files - navila_exp.py (4): experiment error handling - rl_trainer.py (1): training loop fallback - bridge_server.py (1): hardware communication - convert_so101_to_dexdata.py (1): data conversion - convert_lerobot_to_dexdata.py (1): data conversion --- dexbotic/exp/navila_exp.py | 8 ++++---- dexbotic/exp/rl/rl_trainer.py | 2 +- hardware/so101/bridge_server.py | 2 +- hardware/so101/convert_so101_to_dexdata.py | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dexbotic/exp/navila_exp.py b/dexbotic/exp/navila_exp.py index 555b1fb..4534e84 100644 --- a/dexbotic/exp/navila_exp.py +++ b/dexbotic/exp/navila_exp.py @@ -392,7 +392,7 @@ def map_string_to_action(s): try: actions = [map_string_to_action(outputs)] - except: + except Exception: actions = [1] queue_actions = [] @@ -401,7 +401,7 @@ def map_string_to_action(s): try: match = re.search(r"move forward (\d+) cm", outputs) distance = int(match.group(1)) - except: + except Exception: distance = 25 if (distance % 25) != 0: distance = min([25, 50, 75], key=lambda x: abs(x - distance)) @@ -412,7 +412,7 @@ def map_string_to_action(s): try: match = re.search(r"turn left (\d+) degree", outputs) degree = int(match.group(1)) - except: + except Exception: degree = 15 if (degree % 15) != 0: degree = min([15, 30, 45], key=lambda x: abs(x - degree)) @@ -423,7 +423,7 @@ def map_string_to_action(s): try: match = re.search(r"turn right (\d+) degree", outputs) degree = int(match.group(1)) - except: + except Exception: degree = 15 if (degree % 15) != 0: degree = min([15, 30, 45], key=lambda x: abs(x - degree)) diff --git a/dexbotic/exp/rl/rl_trainer.py b/dexbotic/exp/rl/rl_trainer.py index 0958be2..f6e5b47 100644 --- a/dexbotic/exp/rl/rl_trainer.py +++ b/dexbotic/exp/rl/rl_trainer.py @@ -517,7 +517,7 @@ def batch_segment( return [batch] try: original_batch_size = int(original_batch_size) - except: + except Exception: pass rollout_num = original_batch_size // num_segment batch_out = [] diff --git a/hardware/so101/bridge_server.py b/hardware/so101/bridge_server.py index e3ae776..d33dd57 100644 --- a/hardware/so101/bridge_server.py +++ b/hardware/so101/bridge_server.py @@ -47,7 +47,7 @@ def Ready(self, request, context): self.shutdown_event.clear() try: cv2.destroyAllWindows() - except: + except Exception: pass return services_pb2.Empty() diff --git a/hardware/so101/convert_so101_to_dexdata.py b/hardware/so101/convert_so101_to_dexdata.py index 04fbceb..64b246c 100644 --- a/hardware/so101/convert_so101_to_dexdata.py +++ b/hardware/so101/convert_so101_to_dexdata.py @@ -51,7 +51,7 @@ def get_task_list(meta_dir): try: info = json.loads(line) tasks.append(info.get("task", info.get("instruction", ""))) - except: + except Exception: continue return tasks