Skip to content

Add path validation, fix silent folder fallthrough and move traceback import in app.py#40

Open
agentksimha wants to merge 2 commits intohumanai-foundation:mainfrom
agentksimha:main
Open

Add path validation, fix silent folder fallthrough and move traceback import in app.py#40
agentksimha wants to merge 2 commits intohumanai-foundation:mainfrom
agentksimha:main

Conversation

@agentksimha
Copy link

Changes made to ISSR_Communication_Analysis_Tool_Samuel_Kalu/app.py:

  1. Added path validation in get_image_base64
    The function opened the file directly with no existence check. A missing asset throws a generic FileNotFoundError with no context about which asset was missing. Added an explicit check that raises FileNotFoundError with the exact path.

  2. Fixed silent folder path fallthrough in process_multiple_videos
    When folder_path is provided but is not a valid directory, the original code silently falls through to the elif video_files branch with no feedback to the user. Added an explicit elif folder_path and not os.path.isdir(folder_path) branch that returns a clear error message to the user immediately.

  3. Added logo asset validation in create_interface
    get_image_base64 was called with a hardcoded relative path with no existence check. If the assets folder is missing the entire interface crashes at startup. Added a check that logs a warning and renders the interface without the logo rather than crashing.

  4. Moved traceback import to module level
    import traceback appeared twice inside except blocks. Importing inside exception handlers works but is bad practice and adds overhead every time the exception is triggered. Moved to the top of the file with the other imports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant