Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extra checks for reading pickle files #205

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading