SerializationError("can't serialize <class 'range'>")

Hello Community,

We have been hosting STEM educational modules and we haven’t had any issues with bokeh server till we updated bokeh. We had updated our server to bokeh 3.1.0 from bokeh 2.3.x, and one of the learning module is not working. We were able to successfully transition other learning modules/bokeh servers to the bokeh version 3.1.0.

We fixed minor changes of how Tab module name has changed etc. For one of the STEM learning modules we are getting the Serialization error. Unable to figure what is causing the issue, since the error message is pointing to bokeh modules and not to the code written by us. Any idea or pointers on how to determine the root cause of this issue? Have never encountered this previously and do not know how to go about fixing this issue.

The code we are trying to run(which was previously running using older bokeh version 2.3.x): https://github.com/swamilikes2code/Python_based_Interactive_Scientific_Visualization/blob/fix-tab-panel-bug-catalysis/catalysis_visualization/catalysis_data_interactive_visualization.py

Here is the screenshot of the error message:

Thank you for taking your time!

Bokeh won’t “concretize” lazy generators like range (it’s not always the right thing to do, e.g. generators can be infinite—we won’t assume). You will have to create an actual tuple, list, or array from the range yourself.

Thank you for the response Brian. I should look for range objects in our code and ensure they are one of the data types you have mentioned is what I gather.

Will look into it.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.