From aabf739a208ba3e8f639417f2164757b86fa84f0 Mon Sep 17 00:00:00 2001 From: Anouk Vlug Date: Wed, 29 Mar 2023 14:18:11 +0200 Subject: [PATCH] improve error message for shapely module not found error --- oggm/utils/_workflow.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/oggm/utils/_workflow.py b/oggm/utils/_workflow.py index dd5c520ce..6917e5cd1 100644 --- a/oggm/utils/_workflow.py +++ b/oggm/utils/_workflow.py @@ -2978,7 +2978,11 @@ def read_pickle(self, filename, use_compression=None, filesuffix=''): _open = gzip.open if use_comp else open fp = self.get_filepath(filename, filesuffix=filesuffix) with _open(fp, 'rb') as f: - out = pickle.load(f) + try: + out = pickle.load(f) + except ModuleNotFoundError as err: + if str(err) == "No module named 'shapely.io'": + raise ModuleNotFoundError("You need shapely to version 2.0 or higher for this to work.") # Some new attrs to add to old pre-processed directories if filename == 'model_flowlines':