I am trying to debug a piece of code that unexpectedly crashes on one of cv2.resize
calls because of some exception raised in C code. For some reason if I try to run it as python -m pdb file.py
I get "Post mortem debugger finished"
message, and therefore can not enter debugging session, since the current line is set to the script's entry point again. Any tips on how to catch this error in the debugger? I guess opencv python wrapper processes errors incorrectly and crashes the whole process instead of raising a python exception. ipdb
also crashes with some sort of not self._running
assertion error and messes up the whole terminal session for some reason: a lot of symbols such as newline symbol are not processed properly and clear
does not help.
The opencv error is OpenCV Error: Assertion failed (ssize.width > 0 && ssize.height > 0) in resize, file /io/opencv/modules/imgproc/src/resize.cpp, line 4044
. This is the line in opencv sources, it calls CV_Assert()
, no idea how it works. I found a line in python code that causes it, I print sizes of images before running resize and they all are of reasonable sizes.
UPD: I found an ValueError: signal only works in main thread
error in logs, so the issue is that this is a C exception in a different thread.