Skip to content

JSON serialization of OrbitControls fails with jupyter_client 7.0.3 #366

@boehmc

Description

@boehmc

I believe a recent change in the json serialization within jupyter_client leads to the following error when trying to use OrbitControls in a jupyter notebook.

ValueError: Out of range float values are not JSON compliant

The issue is caused by default values of +/- Inf for some parameters in OrbitControls

This can also be seen in the second cell of the built-in example.

Here is a minimal (non)-working example:

import pythreejs camera = pythreejs.PerspectiveCamera( position=[0.0, 0.0, 6.0], fov=20, aspect=1.35, near=0.001 ) controls = pythreejs.OrbitControls( controlling=camera, # minAzimuthAngle=-1.0, # maxAzimuthAngle=1.0, # maxDistance=1.0, # maxZoom=1 )

Removing the commented lines will insert finite values for all parameters that would default to +/- Inf otherwise, after which the serialization works again.

System info:

python --version Python 3.7.10 python -c "import pythreejs; print(pythreejs.version_info)" (2, 3, 0, 'final') jupyter --version Selected Jupyter core packages... IPython : 7.27.0 ipykernel : 6.4.0 ipywidgets : 7.6.5 jupyter_client : 7.0.3 jupyter_core : 4.8.1 jupyter_server : not installed jupyterlab : not installed nbclient : 0.5.4 nbconvert : 6.1.0 nbformat : 5.1.3 notebook : 6.4.4 qtconsole : 5.1.1 traitlets : 5.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions