fix(main.py): handle argument parsing errors and improve error messages
This commit is contained in:
@@ -339,6 +339,7 @@ class VideoEditor:
|
||||
# Apply brightness/contrast first (to original frame for best quality)
|
||||
processed_frame = self.apply_brightness_contrast(processed_frame)
|
||||
|
||||
|
||||
# Apply crop
|
||||
if self.crop_rect:
|
||||
x, y, w, h = self.crop_rect
|
||||
@@ -1420,17 +1421,28 @@ def main():
|
||||
"video", help="Path to video file or directory containing videos"
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
args = parser.parse_args()
|
||||
except SystemExit as e:
|
||||
# If launched from context menu without arguments, this might fail
|
||||
input(f"Argument parsing failed. Press Enter to exit...")
|
||||
return
|
||||
|
||||
if not os.path.exists(args.video):
|
||||
print(f"Error: {args.video} does not exist")
|
||||
error_msg = f"Error: {args.video} does not exist"
|
||||
print(error_msg)
|
||||
input("Press Enter to exit...") # Keep window open in context menu
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
editor = VideoEditor(args.video)
|
||||
editor.run()
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
error_msg = f"Error initializing video editor: {e}"
|
||||
print(error_msg)
|
||||
import traceback
|
||||
traceback.print_exc() # Full error trace for debugging
|
||||
input("Press Enter to exit...") # Keep window open in context menu
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user