From f1138abca0a146092fce10c457dd83097b6df7d3 Mon Sep 17 00:00:00 2001 From: mhz1g21 <mhz1g21@soton.ac.uk> Date: Thu, 12 Dec 2024 14:38:45 +0000 Subject: [PATCH] Add error handling for file renaming in MBDNetTab --- scripts/debug_tool/tabs/mbdnet_tab.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/debug_tool/tabs/mbdnet_tab.py b/scripts/debug_tool/tabs/mbdnet_tab.py index b987e2a..165d59d 100644 --- a/scripts/debug_tool/tabs/mbdnet_tab.py +++ b/scripts/debug_tool/tabs/mbdnet_tab.py @@ -327,10 +327,16 @@ class MBDNetTab(QWidget): if success: print("MBDNet process completed successfully") update_status_indicator(self.MBDNet_status, "Complete") - os.rename(os.path.join(self.input_dir, 'shifted_t.png'), os.path.join(self.input_dir, 'rgb.png')) - os.rename(os.path.join(self.input_dir, 'shifted_disparity.png'), os.path.join(self.input_dir, 'depth_e.png')) - os.rename(os.path.join(self.output_dir, 'scene_completed_prediction.mtl'), os.path.join(self.output_dir, 'Input_prediction_mesh.mtl')) - os.rename(os.path.join(self.output_dir, 'scene_completed_prediction.obj'), os.path.join(self.output_dir, 'Input_prediction_mesh.obj')) + try: + os.rename(os.path.join(self.input_dir, 'shifted_t.png'), os.path.join(self.input_dir, 'rgb.png')) + os.rename(os.path.join(self.input_dir, 'shifted_disparity.png'), os.path.join(self.input_dir, 'depth_e.png')) + os.rename(os.path.join(self.output_dir, 'scene_completed_prediction.mtl'), os.path.join(self.output_dir, 'Input_prediction_mesh.mtl')) + os.rename(os.path.join(self.output_dir, 'scene_completed_prediction.obj'), os.path.join(self.output_dir, 'Input_prediction_mesh.obj')) + except Exception as e: + print(f"Error renaming files: {str(e)}") + self.update_status(f"Error renaming files: {str(e)}") + self.update_status("Please make sure you are connected to the University Network/Gloabl Protect") + self.update_depth_preview() else: print("MBDNet process failed") -- GitLab