Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rmgpy/data/kinetics/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,15 @@ def load_recommended_families(self, filepath):

Both styles can be loaded by this method.
"""
import imp
import importlib

# Load the recommended.py file as a module
try:
rec = imp.load_source('rec', filepath)
# https://docs.python.org/3/whatsnew/3.12.html#imp
loader = importlib.machinery.SourceFileLoader('rec', filepath)
spec = importlib.util.spec_from_file_location('rec', filepath, loader=loader)
rec = importlib.util.module_from_spec(spec)
loader.exec_module(rec)
except Exception as e:
raise DatabaseError('Unable to load recommended.py file for kinetics families: {0!s}'.format(e))

Expand Down
Loading