Forum: Poser Python Scripting


Subject: Useful Code Snippets

structure opened this issue on Jun 27, 2019 ยท 94 posts


adp001 posted Tue, 09 November 2021 at 7:03 AM

Some more about error handling. This time as decorator to "protect" functions:

def no_err(f):
def _f():
try:
f()
except Exception as err:
pass
return(_f)


@no_err
def test(*args, **kwargs):
a = 3
print(a) # ok
print(a + b) # generates error
print("unreachable because of error")