-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Labels
BugProblems in the build system, build scripts, etc or faults in the interface.Problems in the build system, build scripts, etc or faults in the interface.
Description
Describe the bug
In the Python OSI Trace reader (format/OSITrace.py), when using the binary OSI trace format (type_name=None), the method get_messages_in_index_range(bening, end) ignores the arguments begin and end. Instead, it always returns an iterator over all messages. Because of that, the method get_message_by_index(index) always returns the first message regardless of the index argument.
Describe how to reproduce the bug
Steps to reproduce the behavior:
tr = OSITrace()
tr.from_file("MySensorViewTrace.osi")
l = list(tr.get_messages_in_index_range(10, 12))
m = tr.get_message_by_index(5)l contains all message instead of messages 10, 11 and 12, m is message 0 instead if message 5.
Describe the expected behavior
l contains only the messages 10, 11 and 12 (or at least a documentation that it does not work as expected).
Describe the OS you are using
- OS: Windows 10
- Python 3.6.8 64-bit
Additional context
Possible fix:
- In the "OSI"-branch of the method, replace
self.scenario_file.seek(0)withself.scenario_file.seek(self.message_offsets[begin]) - in the
whileloop condition, end withmin(len(serialized_message), self.message_offsets[end+1])(requires additional index range check forself.message_offsets)
Metadata
Metadata
Assignees
Labels
BugProblems in the build system, build scripts, etc or faults in the interface.Problems in the build system, build scripts, etc or faults in the interface.