Can exceptions still interrupt the execution when they are wrapped in an appropriate try/except block?

45 Views Asked by At

I have some debugging code (involving debugpy.connect()) in a custom package, which is expected to raise an exception if the debug server isn't currently launched. The thing is, that code is wrapped in a try / except Exception clause, as I don't want it to interrupt the execution of the programs that call it when I'm not debugging (it's just there if I need it).

But then, when pip install tries to install that package in my virtual environment, it fails at that point, with a Traceback that make it look as if the exception wasn't caught.

This seems particularly weird to me. Outside of pip install, it works as expected and the exception is caught, and the program keeps running.

I've also tried with a bare except clause, it also let the exception "escape". I tried researching this on Google, looking at all the possible ways an exception might not be properly caught, and I couldn't find anything.

Do you know what might be causing this?

0

There are 0 best solutions below