Dash suppress_callback_exceptions not working

11,157

Solution 1

For any future viewers: This bug was fixed some time after the question was posted.

The oldest answer does technically fix it, but it will also disable real callback errors along the way (that aren't fired on the start). If you are looking for where to put suppress_callback_exceptions=True, put it in the app declaration itself, like:
app = dash.Dash( ... , suppress_callback_exceptions=True).

Solution 2

Figured it out

if __name__ == '__main__':
    app.run_server(debug=False,dev_tools_ui=False,dev_tools_props_check=False)

Needed to just disable dev_tools_ui on the actual webpage

Solution 3

When I ran into this problem, I had to place the config statement immediately after the app creation to suppress the errors. For example:

app=dash.Dash(__name__)
app.config.suppress_callback_exceptions=True

Found my answer here and it worked for me.

Share:
11,157
Nbishop
Author by

Nbishop

Updated on July 29, 2022

Comments

  • Nbishop
    Nbishop almost 2 years

    Here is how I implement it in my code. I have tried each way individually and using all of them as uncommented lines of code. No matter the combination of methods I use, I still have to manually turn suppress errors once my dashboard loads.

    app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
    app.title = 'TEST'
    
    app.config['suppress_callback_exceptions'] = True
    app.config.suppress_callback_exceptions = True
    

    I have also tried (without any luck):

    app = dash.Dash(__name__, external_stylesheets=external_stylesheets,
                    suppress_callback_exceptions = True)
    

    and

    import sys
    class HaltCallback(Exception):
        pass
    
    @app.server.errorhandler(HaltCallback)
    def handle_error(error):
        print(error, file=sys.stderr)
        return ('', 204)
    

    Are there any other possible ways I can try to suppress the callback exceptions? I'm making a dashboard for my boss, so I'd really like automate the error suppression upon loading it.