Skip to content

Commit

Permalink
Make qcengine_list tolerant of qcengine not installed
Browse files Browse the repository at this point in the history
  • Loading branch information
bennybp committed Sep 10, 2023
1 parent 220db82 commit 685ecfe
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions qcfractalcompute/qcfractalcompute/run_scripts/qcengine_list.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import json

import qcengine

# This script returns the programs/procedures available in qcengine
# as a dictionary of {program: version}
# It is meant to be used with subprocess to get the available programs
# in a conda environment

if __name__ == "__main__":
r = qcengine.list_available_programs() | qcengine.list_available_procedures()
try:
import qcengine

progs = {x: qcengine.get_program(x).get_version() for x in qcengine.list_available_programs()}
procs = {x: qcengine.get_procedure(x).get_version() for x in qcengine.list_available_procedures()}
progs["qcengine"] = qcengine.__version__

progs = {x: qcengine.get_program(x).get_version() for x in qcengine.list_available_programs()}
procs = {x: qcengine.get_procedure(x).get_version() for x in qcengine.list_available_procedures()}
progs["qcengine"] = qcengine.__version__
except ImportError:
progs = {}
procs = {}

print(json.dumps({**progs, **procs}))

0 comments on commit 685ecfe

Please sign in to comment.