diff --git a/psi4/run_psi4.py b/psi4/run_psi4.py index 217d7355d03..8edd6687416 100755 --- a/psi4/run_psi4.py +++ b/psi4/run_psi4.py @@ -33,6 +33,7 @@ import datetime import json import os +import re import sys import warnings from pathlib import Path @@ -200,6 +201,12 @@ data_dir = os.path.abspath(os.path.expanduser(args["psidatadir"])) os.environ["PSIDATADIR"] = data_dir +if args["version"]: + with (psi4_module_loc / "metadata.py").open() as fp: verline = fp.readline() + __version__ = re.match(r"__version__ = ['\"](?P.*)['\"]", verline).group("ver") + print(__version__) + sys.exit() + ### Actually import psi4 and apply setup ### # Arrange for warnings to ignore everything except the message @@ -212,10 +219,6 @@ def custom_formatwarning(msg, *args, **kwargs): sys.path.insert(1, lib_dir) import psi4 # isort:skip -if args["version"]: - print(psi4.__version__) - sys.exit() - # Prevents a poor option combination if args['plugin_template'] and (not args['plugin_name']): raise KeyError("Please specify a '--plugin-name' for your plugin template!")