PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

fix: remove leftover debugging code and improve error handling in yolo_mapping.py

Open Dotify71 opened this issue 5 months ago • 4 comments

Describe the bug or improvement The database module backend/app/database/yolo_mapping.py contains leftover debugging code (import os and print(os.getcwd())) that clutters the console output every time the YOLO classes table is created.

Additionally, the database execution block lacks proper except sqlite3.Error handling and logging, which is inconsistent with the rest of the database modules.

Proposed Solution if anyone wants to work

  1. Remove the leftover import os and print(os.getcwd()) from db_create_YOLO_classes_table.
  2. Wrap the cursor.execute calls in an except sqlite3.Error block to catch and log database failures properly using the project's standard logger (logger.error()), matching the recent cleanup done in faces.py, metadata.py, etc.

This is a good first issue for anyone looking to contribute!

Dotify71 avatar Jun 12 '26 07:06 Dotify71

👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)

github-actions[bot] avatar Jun 12 '26 07:06 github-actions[bot]

Hi! I noticed this leftover debugging code while exploring the backend database module, and I would love to fix it.

My approach will be:

  1. Delete the import os and print(os.getcwd()) statements from yolo_mapping.py.
  2. Add from app.logging.setup_logging import get_logger to integrate the standard logger.
  3. Wrap the database operations inside a try...except sqlite3.Error as e: block.
  4. Add logger.error(...) inside the except block to properly catch and document any SQL failures.

Could you please assign this to me? Thanks!

Dotify71 avatar Jun 12 '26 07:06 Dotify71

⚠️ Potential Duplicate Issue (Semantic Match)

This issue appears semantically similar to the following issues in AOSSIE-Org/PictoPy:

  1. fix: remove debug print statement and improve error handling in yolo_mapping.py (#1221, closed) https://github.com/AOSSIE-Org/PictoPy/issues/1221 Similarity: 89.3%

Please review before proceeding.

github-actions[bot] avatar Jun 12 '26 07:06 github-actions[bot]

Hello @Dotify71 I will Like to work on this Issue..if it's still open!

JIturiDashami avatar Nov 01 '26 10:11 JIturiDashami

5. Hello @Dotify71 I will Like to work on this Issue..if it's still open!

Yeah its open u can work. Just discuss with @rohan-pandeyy and st working :))

Dotify71 avatar Nov 01 '26 10:11 Dotify71