From d4eeaf0e4760f0fdb1873841e284daaf6d5710f9 Mon Sep 17 00:00:00 2001 From: Tim Dudgeon Date: Thu, 12 Mar 2026 13:23:51 +0000 Subject: [PATCH] specific catch for MemoryError --- src/xchemalign/aligner.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/xchemalign/aligner.py b/src/xchemalign/aligner.py index 781048f..b5f9fb5 100644 --- a/src/xchemalign/aligner.py +++ b/src/xchemalign/aligner.py @@ -896,8 +896,24 @@ def main(): f = shutil.copy2(logger.logfilename, to_path) if not f: print("Failed to copy log file {} to {}".format(logger.logfilename, to_path)) + except MemoryError: + tb = traceback.format_exc() + if args.dir: + wd = args.dir + else: + wd = Path.cwd() + logger.error( + "Memory error occurred when running aligner.\n" + + "Possibly this can be addressed by running on the IRIS Slurm cluster where more memory is available.\n" + + "See https://xchem-align.readthedocs.io/en/latest/USER-GUIDE.html#using-the-slurm-cluster for details.\n" + + tb + + "\nOtherwise please send this information to the XCA developers:\nLog file: " + + str(logger.logfilename) + + "\nWorking dir location: " + + str(wd) + ) except: - # uncaught exception + # other uncaught exception tb = traceback.format_exc() if args.dir: wd = args.dir