KeyError : autorange in dash 0.40.0

I worked on a dash project a year ago. At that time i was using dash 0.22.0 version. Now as I upgrade my dash to the current version it showing autorange error.

Here is a small part of the code

           print('No Bookmarks Found........NOT AN ERROR.......')
           raise dash.exceptions.PreventUpdate()
     if figure['layout']['xaxis']['autorange'] is True:    // getting error on this line
           print('all visible........NOT AN ERROR.......')
           raise dash.exceptions.PreventUpdate()

Error is -

     File "C:\Users\a19.mittal\Desktop\ssrmAnalyser - Copy\pages\", line 1036, in mainPlotEditor
     if figure['layout']['xaxis']['autorange'] is True:
     KeyError: 'autorange'

I’m not able to correct this error.
Thanks :slight_smile:

Since the autorange option is still there I would check what is the content of the xaxis dict in your example, as I believe this it the case (I see that you load something from storage so probably the loaded layout do not have this option set (you can always use figure[‘layout’][‘xaxis’].get(‘autorange’, False) is True (or any other default return value if key is not found))