LLNL / SSAPy

A Python package allowing for fast and precise orbital modeling.
https://software.llnl.gov/SSAPy/
MIT License
36 stars 8 forks source link

SSAPy v1.0.0 not properly closing the lunar harmonics file? #1

Open aperloff opened 7 months ago

aperloff commented 7 months ago

Describe the bug It seems that SSAPy is opening file ssapy/data/de430.bsp multiple times and not closing it.

To Reproduce too be filled in

Expected behavior We expect that you can run any number of operations without SSAPy crashing due to having too many files open.

Output

File "<path to ssapy>/ssapy/body.py", line 294, in get_body
  File "<path to ssapy>/ssapy/body.py", line 171, in __init__
  File "<path to site-packages>/site-packages/jplephem/spk.py", line 47, in open
OSError: [Errno 24] Too many open files: '<path to ssapy>/ssapy/data/de430.bsp'

Desktop (please complete the following information):

igoumiri commented 5 months ago

According to the docs, we need to call self.kernel.close(). To do that cleanly we would need to turn those classes into context managers.