kevincalori
Posts2Registration dateFriday August 9, 2024StatusMemberLast seenAugust 27, 2024
-
Updated on Sep 8, 2024 at 08:36 AM
Hello everyone,
I am facing a problem with my Python script when trying to handle exceptions. I am using a try/except block to catch errors; but instead of catching the specific exception I am expecting, the script seems to bypass the block entirely and raises an unhandled exception.
try:
# Some operation that could raise an error
result = my_function()
except ValueError as e:
print(f"ValueError caught: {e}")
Despite expecting a ValueError, I get an error message like this: