diff --git a/dimorphite_dl.py b/dimorphite_dl.py index 73719b1..2dadad1 100644 --- a/dimorphite_dl.py +++ b/dimorphite_dl.py @@ -713,11 +713,8 @@ def load_substructre_smarts_file(): pwd = os.path.dirname(os.path.realpath(__file__)) site_structures_file = "{}/{}".format(pwd, "site_substructures.smarts") - lines = [ - l - for l in open(site_structures_file, "r") - if l.strip() != "" and not l.startswith("#") - ] + with open(site_structures_file, "r") as f: + lines = [l for l in f if l.strip() != "" and not l.startswith("#")] return lines