fix: remove leftover debugging code and improve error handling in yolo_mapping.py
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
- Remove the leftover
import osandprint(os.getcwd())fromdb_create_YOLO_classes_table. - Wrap the
cursor.executecalls in anexcept sqlite3.Errorblock to catch and log database failures properly using the project's standard logger (logger.error()), matching the recent cleanup done infaces.py,metadata.py, etc.
This is a good first issue for anyone looking to contribute!
👋 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 :)
Hi! I noticed this leftover debugging code while exploring the backend database module, and I would love to fix it.
My approach will be:
- Delete the
import osandprint(os.getcwd())statements fromyolo_mapping.py. - Add
from app.logging.setup_logging import get_loggerto integrate the standard logger. - Wrap the database operations inside a
try...except sqlite3.Error as e:block. - Add
logger.error(...)inside the except block to properly catch and document any SQL failures.
Could you please assign this to me? Thanks!
⚠️ Potential Duplicate Issue (Semantic Match)
This issue appears semantically similar to the following issues in AOSSIE-Org/PictoPy:
- 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.
Hello @Dotify71 I will Like to work on this Issue..if it's still open!
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 :))