Skip to content
Advertisement

Perform an exception for a list of funtions

hello people (I am new to python) Question: i use ipywidgets with buttons, i want to call a list of function, sometimes there’s a problem in a function (syntax, division by zero,…), i try to put an exception to pass the error and lunch the next function, don’t work :(

I’m running in jupyter environment using python 3.8.5.final.0 and pandas 1.1.3 division by 0 problem of syntax

JavaScript

I meant some prolems in the 2 functions (division by 0 and wrong syntax)

JavaScript

Advertisement

Answer

You’re calling your functions at the wrong time. In

JavaScript

you execute the 3 functions, and store their outputs in the list.

What you want to do is store the functions themselves:

JavaScript

and call them in your try: ... except: block:

JavaScript
Advertisement