diff --git a/newsfragments/XXX.bugfix b/newsfragments/XXX.bugfix new file mode 100644 index 000000000..0f7d62c41 --- /dev/null +++ b/newsfragments/XXX.bugfix @@ -0,0 +1 @@ +Add fix for pickle files diff --git a/src/dxtbx/format/FormatPYmultitile.py b/src/dxtbx/format/FormatPYmultitile.py index 3ff8153d8..e90c8ccef 100644 --- a/src/dxtbx/format/FormatPYmultitile.py +++ b/src/dxtbx/format/FormatPYmultitile.py @@ -20,7 +20,7 @@ def understand(image_file): with FormatPYmultitile.open_file(image_file, "rb") as fh: data = pickle.load(fh, encoding="bytes") data = image_dict_to_unicode(data) - except OSError: + except (AttributeError, OSError): return False wanted_header_items = ["TILES", "METROLOGY"] diff --git a/src/dxtbx/format/FormatPYunspecified.py b/src/dxtbx/format/FormatPYunspecified.py index 1da479994..d384f7194 100644 --- a/src/dxtbx/format/FormatPYunspecified.py +++ b/src/dxtbx/format/FormatPYunspecified.py @@ -27,7 +27,7 @@ def understand(image_file): with FormatPYunspecified.open_file(image_file, "rb") as fh: data = pickle.load(fh, encoding="bytes") data = image_dict_to_unicode(data) - except OSError: + except (AttributeError, OSError): return False headers = set(data)