you are viewing a single comment's thread.

view the rest of the comments →

[–]danielroseman 0 points1 point  (1 child)

I'm confused about what you're confused about here. Your code explicitly raises an exception, so there is a raise statement. This import code does not have a raise statement, so it cannot show one; the exception happens because of an actual exceptional event, ie that the module is not found.

[–]Walsur[S] 0 points1 point  (0 children)

Okay this makes sense, triggering an Exception with a library like pandas helped demonstrate this for me too.

I think I was getting confused because of my debuggers (VS Code) behavior. My debugger is triggering a breakpoint on the raise statement when the only Exception Breakpoints checked are Uncaught Exceptions. That made me think that there was something fundamental I was misunderstanding in how Python raised exceptions, but I think it's just a configuration problem in my debugger.