From 5aad045686265c30de3a390d3c7964eb30d35805 Mon Sep 17 00:00:00 2001 From: Steven Ray Anaya Date: Fri, 23 Sep 2022 16:51:20 -0600 Subject: [PATCH] Improve incompatible python interpreter warning --- python/lammps/mliap/__init__.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/lammps/mliap/__init__.py b/python/lammps/mliap/__init__.py index c04734c86c..b888eb55ce 100644 --- a/python/lammps/mliap/__init__.py +++ b/python/lammps/mliap/__init__.py @@ -5,6 +5,7 @@ import sysconfig import ctypes import platform +import warnings py_ver = sysconfig.get_config_vars('VERSION')[0] OS_name = platform.system() @@ -25,8 +26,10 @@ except Exception as e: raise OSError("Unable to locate python shared library") from e if not pylib.Py_IsInitialized(): - raise RuntimeError("This interpreter is not compatible with python-based mliap for LAMMPS.") + warnings.warn("This interpreter is not compatible with python-based MLIAP for LAMMPS. " + "Attempting to activate the MLIAP-python coupling from python may result " + "in undefined behavior.") +else: + from .loader import load_model, load_unified, activate_mliappy del sysconfig, ctypes, library, pylib - -from .loader import load_model, load_unified, activate_mliappy