From 33a923212dcf7bb9058f533316e8a165dfbc8c5d Mon Sep 17 00:00:00 2001 From: Xen0Xys Date: Thu, 18 Jul 2024 12:46:34 +0200 Subject: [PATCH] :goal_net: Improve error management for hips2fits --- src/ipyaladin/widget.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/ipyaladin/widget.py b/src/ipyaladin/widget.py index c909d655..5468b34c 100644 --- a/src/ipyaladin/widget.py +++ b/src/ipyaladin/widget.py @@ -308,12 +308,16 @@ def hips2fits(self, hips: str, output_file: Optional[str] = None) -> None: The name of the output FITS file. If None, the FITS file is not saved. """ - from astroquery.hips2fits import hips2fits + try: + from astroquery.hips2fits import hips2fits + except ImportError as imp: + raise ValueError( + "To use the hips2fits method, you need to install the astroquery " + "library with 'pip install astroquery'." + ) from imp fits = hips2fits.query_with_wcs( hips=hips, - format="fits", - get_query_payload=False, wcs=self.wcs, ) if output_file is not None: