Skip to content

Commit aa99c86

Browse files
committed
fix: Update examples
1 parent 89988e5 commit aa99c86

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

examples/sign_info.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@
9494
# Sign the image
9595
print("\nSigning the image...")
9696
with open(fixtures_dir + "C.jpg", "rb") as source:
97-
with open(output_dir + "C_signed.jpg", "wb") as dest:
97+
# File needs to be opened in write+read mode to be signed
98+
# and verified properly.
99+
with open(output_dir + "C_signed.jpg", "w+b") as dest:
98100
result = builder.sign(signer, "image/jpeg", source, dest)
99101

100102
# Read the signed image to verify

examples/training.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def getitem(d, key):
122122

123123
# Sign the file using the stream-based sign method
124124
with open(testFile, "rb") as source_file:
125-
with open(testOutputFile, "wb") as dest_file:
125+
with open(testOutputFile, "w+b") as dest_file:
126126
result = builder.sign(signer, "image/jpeg", source_file, dest_file)
127127

128128
# As an alternative, you can also use file paths directly during signing:

0 commit comments

Comments
 (0)