provide example when FileNotFound error occurs

cli-info
Burhan 2 months ago
parent 9a9b644f99
commit ae040ba90a
  1. 7
      ultralytics/cfg/__init__.py

@ -610,7 +610,12 @@ def handle_yolo_info(args: List[str]) -> None:
except SyntaxError as e: except SyntaxError as e:
LOGGER.warning(f"WARNING ⚠ info error: '{e}'.") LOGGER.warning(f"WARNING ⚠ info error: '{e}'.")
except FileNotFoundError: except FileNotFoundError:
LOGGER.error(f"Model '{file}' not found, try providing full path to file.") fp_ex = Path.cwd().absolute() / file # show file and current working directory as full-path example
LOGGER.error(
f"{colorstr('red', 'bold', 'ERROR:')} Model '{colorstr('yellow', file)}' not found, try providing full path to file."
"\n"
f"\t{colorstr('underline', 'Usage:')} {colorstr('cyan',f'yolo info model={fp_ex}')}"
)
except Exception as e: except Exception as e:
LOGGER.error(f"WARNING ⚠ info error: {e}") LOGGER.error(f"WARNING ⚠ info error: {e}")

Loading…
Cancel
Save