Skip to content

Commit aed5010

Browse files
authored
Add AttributeError as suspect for dependency issue (openml#1121)
* Add AttributeError as suspect for dependency issue Happens for example when loading a 1.3 dataframe with a 1.0 pandas.
1 parent b4c868a commit aed5010

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

openml/datasets/dataset.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -544,15 +544,23 @@ def _load_data(self):
544544
data, categorical, attribute_names = pickle.load(fh)
545545
except FileNotFoundError:
546546
raise ValueError(f"Cannot find file for dataset {self.name} at location '{fpath}'.")
547-
except (EOFError, ModuleNotFoundError, ValueError) as e:
547+
except (EOFError, ModuleNotFoundError, ValueError, AttributeError) as e:
548548
error_message = e.message if hasattr(e, "message") else e.args[0]
549549
hint = ""
550550

551551
if isinstance(e, EOFError):
552552
readable_error = "Detected a corrupt cache file"
553-
elif isinstance(e, ModuleNotFoundError):
553+
elif isinstance(e, (ModuleNotFoundError, AttributeError)):
554554
readable_error = "Detected likely dependency issues"
555-
hint = "This is most likely due to https://github.com/openml/openml-python/issues/918. " # noqa: 501
555+
hint = (
556+
"This can happen if the cache was constructed with a different pandas version "
557+
"than the one that is used to load the data. See also "
558+
)
559+
if isinstance(e, ModuleNotFoundError):
560+
hint += "https://github.com/openml/openml-python/issues/918. "
561+
elif isinstance(e, AttributeError):
562+
hint += "https://github.com/openml/openml-python/pull/1121. "
563+
556564
elif isinstance(e, ValueError) and "unsupported pickle protocol" in e.args[0]:
557565
readable_error = "Encountered unsupported pickle protocol"
558566
else:

0 commit comments

Comments
 (0)