From c1891dca8258482d9b226edc48e91ea0755c83ee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 9 May 2021 05:58:20 -0400 Subject: [PATCH] explicitly set vstring to None in case of exceptions --- python/lammps/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/lammps/__init__.py b/python/lammps/__init__.py index 2c0e7a6fe3..3e538d3e49 100644 --- a/python/lammps/__init__.py +++ b/python/lammps/__init__.py @@ -28,12 +28,15 @@ def get_version_number(): from importlib.metadata import version try: vstring = version('lammps') - except: pass + except: + vstring = None + else: from pkg_resources import get_distribution try: vstring = get_distribution('lammps').version - except: pass + except: + vstring = None if not vstring: return 0