You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
In a few locations within this package, if some condition is not met, an error message is printed and then the interpreter is instructed to exit(). Instead it would be better to raise an exception and allow the consuming program to handle the error condition, perhaps via graceful exit itself. This especially poses an issue in scenarios involving multiprocessing as these error messages may become lost or cause a subprocess to exit but the main program continues to run. Another scenario where this causes issues is when using tqdm progress bars, which will tend to overwrite any standard output and causing the message to be lost. Finally, we lose any context for the error, since no stack trace is generated.
Here are some locations where errors are handled by printing then exiting:
f"Each `Detection` object should have a property `points` of shape (num_of_points_to_track, 2), not {points.shape}. Check your `Detection` list creation code."
)
print("You can read the documentation for the `Detection` class here:")
Hi @quantumdot, thanks for your observation. This behavior was defined a long time ago, and it isn't a bug, actually. Until now, we didn't have the need to change this, so we left it like this.
If you need this behavior to change, we encourage you to open a PR with the changes!
Describe the bug
In a few locations within this package, if some condition is not met, an error message is printed and then the interpreter is instructed to
exit()
. Instead it would be better to raise an exception and allow the consuming program to handle the error condition, perhaps via graceful exit itself. This especially poses an issue in scenarios involving multiprocessing as these error messages may become lost or cause a subprocess to exit but the main program continues to run. Another scenario where this causes issues is when using tqdm progress bars, which will tend to overwrite any standard output and causing the message to be lost. Finally, we lose any context for the error, since no stack trace is generated.Here are some locations where errors are handled by printing then exiting:
norfair/norfair/tracker.py
Lines 296 to 300 in 705f87c
norfair/norfair/tracker.py
Lines 487 to 491 in 705f87c
norfair/norfair/video.py
Lines 178 to 180 in 50f5607
norfair/norfair/utils.py
Lines 21 to 30 in cda59f7
To Reproduce
Any condition which would trigger one of the above conditionals.
Expected behavior
An exception would be raised, the consuming program can decide how to proceed.
Screenshots or videos
N/A
Environment (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: