Skip to content

Commit

Permalink
Fix rosbag API for Python 3
Browse files Browse the repository at this point in the history
Closes ros#1047
  • Loading branch information
Matthias Horne committed Aug 23, 2017
1 parent 7e96839 commit acee48f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/rosbag/src/rosbag/bag.py
Original file line number Diff line number Diff line change
Expand Up @@ -1580,7 +1580,7 @@ def _read_uint32(f): return _unpack_uint32(f.read(4))
def _read_uint64(f): return _unpack_uint64(f.read(8))
def _read_time (f): return _unpack_time (f.read(8))

def _unpack_str(v): return v.decode()
def _decode_str(v): return v if type(v) is str else v.decode()
def _unpack_uint8(v): return struct.unpack('<B', v)[0]
def _unpack_uint32(v): return struct.unpack('<L', v)[0]
def _unpack_uint64(v): return struct.unpack('<Q', v)[0]
Expand Down Expand Up @@ -1629,7 +1629,7 @@ def _read_field(header, field, unpack_fn):

return value

def _read_str_field (header, field): return _read_field(header, field, _unpack_str)
def _read_str_field (header, field): return _read_field(header, field, _decode_str)
def _read_uint8_field (header, field): return _read_field(header, field, _unpack_uint8)
def _read_uint32_field(header, field): return _read_field(header, field, _unpack_uint32)
def _read_uint64_field(header, field): return _read_field(header, field, _unpack_uint64)
Expand Down

0 comments on commit acee48f

Please sign in to comment.