From: W. Trevor King Date: Sat, 21 Jul 2012 13:07:36 +0000 (-0400) Subject: Convert buffer(...) -> bytes(...) for Python 3 compatibility. X-Git-Tag: v0.2~6 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=93014f2ba67643b9294967c8a4fe1e8d39509013;p=igor.git Convert buffer(...) -> bytes(...) for Python 3 compatibility. --- diff --git a/igor/binarywave.py b/igor/binarywave.py index b172312..ab49cdd 100644 --- a/igor/binarywave.py +++ b/igor/binarywave.py @@ -82,10 +82,10 @@ class StaticStringField (_DynamicField): if end > start: strings.append(d[start:end]) if self._null_terminated: - strings[-1] = strings[-1].split('\x00', 1)[0] + strings[-1] = strings[-1].split(b'\x00', 1)[0] start = end elif self._null_terminated: - d = d.split('\x00', 1)[0] + d = d.split(b'\x00', 1)[0] return d diff --git a/igor/packed.py b/igor/packed.py index c644063..da773bb 100644 --- a/igor/packed.py +++ b/igor/packed.py @@ -67,7 +67,7 @@ def load(filename, strict=True, ignore_unknown=True): while True: PackedFileRecordHeader.byte_order = initial_byte_order PackedFileRecordHeader.setup() - b = buffer(f.read(PackedFileRecordHeader.size)) + b = bytes(f.read(PackedFileRecordHeader.size)) if not b: break if len(b) < PackedFileRecordHeader.size: @@ -88,7 +88,7 @@ def load(filename, strict=True, ignore_unknown=True): header = PackedFileRecordHeader.unpack_from(b) _LOG.debug( 'reordered version: {}'.format(header['version'])) - data = buffer(f.read(header['numDataBytes'])) + data = bytes(f.read(header['numDataBytes'])) if len(data) < header['numDataBytes']: raise ValueError( ('not enough data for the next record ({} < {})'