From aa1501db782dc6b6b6e4df1031c90ba7145ff77e Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Fri, 7 Jul 2023 21:36:46 +0800 Subject: [PATCH] Pyvista 0.40 warnings (#280) * fixing import warning * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Removing unused import --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- ansys/mapdl/reader/__init__.py | 7 ++++++- ansys/mapdl/reader/misc.py | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ansys/mapdl/reader/__init__.py b/ansys/mapdl/reader/__init__.py index d3dd2ebb..db498d6c 100644 --- a/ansys/mapdl/reader/__init__.py +++ b/ansys/mapdl/reader/__init__.py @@ -3,7 +3,12 @@ import appdirs # Per contract with Sphinx-Gallery, this method must be available at top level -from pyvista.utilities.sphinx_gallery import _get_sg_image_scraper +try: + # for pyvista >= 0.40 + from pyvista.plotting.utilities import _get_sg_image_scraper +except ImportError: + from pyvista.utilities.sphinx_gallery import _get_sg_image_scraper + from ansys.mapdl.reader import examples from ansys.mapdl.reader._version import __version__ diff --git a/ansys/mapdl/reader/misc.py b/ansys/mapdl/reader/misc.py index 7d3f99d4..fc84ca22 100644 --- a/ansys/mapdl/reader/misc.py +++ b/ansys/mapdl/reader/misc.py @@ -6,7 +6,13 @@ import numpy as np import pyvista -from pyvista.utilities.errors import GPUInfo + +try: + # for pyvista >= 0.40 + from pyvista.report import GPUInfo +except ImportError: + from pyvista.utilities.errors import GPUInfo + import scooby