How to a handle C++ exception coming in python library (implemented in C++)?

179 views Asked by At

I am trying to write a face verification API in python. For image detection and calculating the embeddings, I have used InsightFace package provided by http://insightface.ai/. But for specific images (images having no face, more than one face and HQ images) it is giving some exception -

libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Abort trap: 6

and program (webserver) gets aborted.

As I can debug is that, this exception is coming from model.get() function (its syntax can be found at above link). Now two things -

1) How to handle this exception in my python program, so that I can prevent my server from getting stopped?

2) Also, in case someone suggests how to avoid this error, it will also be great.

Looking forward to this.

0

There are 0 answers