Skip to content

Commit 243a97e

Browse files
authored
Merge pull request #473 from aabadie/fix_hex_loader_python3
flash/loader: fix python3 compatibility issue with hex files
2 parents 5c05b0f + 8029113 commit 243a97e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pyocd/flash/loader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,11 @@ def program(self, file_or_path, format=None, **kwargs):
122122
try:
123123
# Open the file if a path was provided.
124124
if isPath:
125-
file_obj = open(file_or_path, "rb")
125+
mode = 'rb'
126+
if format == 'hex':
127+
# hex file must be read as plain text file
128+
mode = 'r'
129+
file_obj = open(file_or_path, mode)
126130
else:
127131
file_obj = file_or_path
128132

0 commit comments

Comments
 (0)