Dash webapps: logging errors within callback code?

MarkPundurs
Level 3
Dash webapps: logging errors within callback code?

In a dash webapp, I was trying to filter a table by the value selected in a dropdown. It was silently failing to alter the table contents because in the callback function I was calling df.drop('colname') instead of df.drop(columns='colname'). The backend ran without reported error or log file entry.

How can I log such errors? It seems dash's app.run[_server] function has debugging options (https://dash.plotly.com/reference), but that function appears to be called behind the curtains in DSS.

0 Kudos
3 Replies
VitaliyD
Dataiker

Hi,

Technically using df.drop('colname') in the callback function should of throw the exception that should be printed in the logs unless you are using try/except or df.drop('colname', errors='ignore') which suppresses the error. However, it is impossible to say more without seeing your code.

Below are the screenshots of my test to confirm the above:

Screenshot 2023-04-26 at 17.23.50.pngScreenshot 2023-04-26 at 17.24.14.png

 

Best,

Vitaliy

0 Kudos
MarkPundurs
Level 3
Author

Was your testing on DSS v11?

0 Kudos
VitaliyD
Dataiker

Yes, 11.4.0.

0 Kudos