Skip to content

Commit

Permalink
flash/loader: fix python3 compatibility issue with hex files
Browse files Browse the repository at this point in the history
  • Loading branch information
aabadie committed Dec 13, 2018
1 parent 5c05b0f commit 8029113
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pyocd/flash/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ def program(self, file_or_path, format=None, **kwargs):
try:
# Open the file if a path was provided.
if isPath:
file_obj = open(file_or_path, "rb")
mode = 'rb'
if format == 'hex':
# hex file must be read as plain text file
mode = 'r'
file_obj = open(file_or_path, mode)
else:
file_obj = file_or_path

Expand Down

0 comments on commit 8029113

Please sign in to comment.