Skip to content

Catch ImportError instead of Exception for FigureWidget #3995

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 4, 2023

Conversation

nvaytet
Copy link
Contributor

@nvaytet nvaytet commented Dec 23, 2022

distutils is deprecated. When using the FigureWidget in unit tests with pytest where warnings are promoted to errors, the warning becomes an error and the confusing error message is that we have to install ipywidgets>=7.0.0, even if ipywidgets is installed in the current environment.

This occurs because the try/except block is catching all exceptions, instead of just the ImportError which would be the error raised if ipywidgets was unavailable.

Alternatively, we could replace the LooseVersion with packaging.version, but I am not sure if this has wider implications.

`distutils.version` is deprecated. When using the `FigureWidget` in unit tests with `pytest` where warnings are promoted to errors, the warning becomes an error and the error message is that we have to install `ipywidgets>=7.0.0`, even if `ipywidgets` is installed in the current environment.
@nicolaskruchten
Copy link
Contributor

Thanks!

@nicolaskruchten nicolaskruchten merged commit 3192ea8 into plotly:master Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants