Skip to content

Commit

Permalink
Merge pull request #21 from keepkey/py3_upload
Browse files Browse the repository at this point in the history
Fix upload via python3
  • Loading branch information
scott-keepkey authored Feb 19, 2018
2 parents d5718f8 + 24e5b4a commit 0f636f4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions keepkeyctl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ class Commands(object):
raise Exception("Must provide firmware filename or URL")

if args.file:
fp = open(args.file, 'r')
fp = open(args.file, 'rb')
elif args.url:
print("Downloading from", args.url)
resp = urllib.urlretrieve(args.url)
Expand All @@ -316,8 +316,9 @@ class Commands(object):
fp_old.close()

fp.seek(0)
if fp.read(4) != 'KPKY':
raise Exception("KeepKey firmware header expected")
magic = fp.read(4).decode("utf-8")
if magic != 'KPKY':
raise Exception("KeepKey firmware header expected. magic={}".format(magic))

print("Please confirm action on device...")

Expand Down

0 comments on commit 0f636f4

Please sign in to comment.