Skip to content

Exception when running osi2read.py #437

@serge-m

Description

@serge-m

Describe the bug

Exception when running osi2read.py
Typo in the code

Describe how to reproduce the bug

Steps to reproduce the behavior:

  1. Download compressed OSI file. https://github.com/OpenSimulationInterface/open-simulation-interface/blob/250137581977f962acef6c2003c3d61fb55fb964/tests/data/small_test.txt.lzma
  2. Clone open-simulation-interface locally and install it as described in the official readme: https://github.com/OpenSimulationInterface/open-simulation-interface/tree/250137581977f962acef6c2003c3d61fb55fb964#install-for-python-usage
  3. go to format directory, copy small_test.txt.lzma there.
  4. python osi2read.py --data small_test.txt.lzma --output zaza.txt

Describe the expected behavior

Expected behavior: output text file is created.

Actual behavior: exception

/home/user/work/hackathon/open-simulation-interface/format/OSITrace.py:139: RuntimeWarning: Unexpected end-group tag: Not all data was converted
  message.ParseFromString(serialized_message[i+INT_LENGTH:i+INT_LENGTH+message_length])

Error
Traceback (most recent call last):
  File "/usr/lib/python3.6/unittest/case.py", line 59, in testPartExecutor
    yield
  File "/usr/lib/python3.6/unittest/case.py", line 605, in run
    testMethod()
  File "/home/user/work/hackathon/open-simulation-interface/tests/test_osi_trace.py", line 18, in test_osi_trace
    trace.make_readable(path_output, index=1)
  File "/home/user/work/hackathon/open-simulation-interface/format/OSITrace.py", line 239, in make_readable
    f.write(str(scenario.get_message_by_index(0)))
NameError: name 'scenario' is not defined

Show some screenshots

see stacktrace above

Describe the OS you are using

  • OS: Ubuntu 18.04
  • Language: Python
  • Version 3.6.9

Additional context

none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions