From 081439da8092b8c5d9d4a88189c678d6b618407c Mon Sep 17 00:00:00 2001 From: MintoDA1 <51412913+MintoDA1@users.noreply.github.com> Date: Wed, 2 Aug 2023 19:21:39 -0400 Subject: [PATCH] Fixed another edge case when parsing Horizons output for mass --- python/swiftest/swiftest/init_cond.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/python/swiftest/swiftest/init_cond.py b/python/swiftest/swiftest/init_cond.py index fba02b387..978fe9808 100644 --- a/python/swiftest/swiftest/init_cond.py +++ b/python/swiftest/swiftest/init_cond.py @@ -56,9 +56,12 @@ def get_Gmass(raw_response): if len(GM) == 0: return None GM = GM[0] - GM = GM.split('GM')[1] - GM = GM.split('=')[1] - GM = GM.strip().split(' ')[0].split('+')[0] + if len(GM) > 1: + GM = GM.split('GM')[1] + if len(GM) > 1: + GM = GM.split('=') + if len(GM) > 1: + GM = GM[1].strip().split(' ')[0].split('+')[0] try: GM = float(GM) except: