Merge pull request #145 from reedlove/patch-2

Update file2str.py for Python 3 compat
This commit is contained in:
Mike Naberezny 2015-03-03 08:56:01 -08:00
commit 2e209c805e

View File

@ -40,7 +40,10 @@ try:
chunk = src.read(16) chunk = src.read(16)
if chunk: if chunk:
for b in chunk: for b in chunk:
dst.write('0x%02x' % ord(b)) # For Python 2.x compatibility.
if isinstance(b, str):
b = ord(b)
dst.write('0x%02x' % b)
offs = offs + 1 offs = offs + 1
if offs != byteCount: if offs != byteCount:
dst.write(',') dst.write(',')