Skip to content

Commit

Permalink
Extra checks for reading pickle files
Browse files Browse the repository at this point in the history
This allows the registry to ignore dials mask files for these classes
  • Loading branch information
phyy-nx committed Jul 31, 2024
1 parent 3102224 commit cc7e6a1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions newsfragments/XXX.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add fix for pickle files
2 changes: 1 addition & 1 deletion src/dxtbx/format/FormatPYmultitile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion src/dxtbx/format/FormatPYunspecified.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit cc7e6a1

Please sign in to comment.