pyoscx / scenariogeneration

Python library to generate linked OpenDRIVE and OpenSCENARIO files
Mozilla Public License 2.0
276 stars 86 forks source link

UnboundLocalError when trying ParseOpenScenario #64

Closed SimoneMaragliulo closed 2 years ago

SimoneMaragliulo commented 2 years ago

Trying to run the following code:

from scenariogeneration import esmini
from scenariogeneration import xodr
from scenariogeneration import xosc
from scenariogeneration import ScenarioGenerator

a = xosc.ParseOpenScenario('untitled01.xosc')

I get the following error:

  File "<ipython-input-53-b30643905e74>", line 1, in <module>
    b = xosc.ParseOpenScenario('my_scenarios/xosc/untitled01.xosc')

  File "C:\Users\user\Anaconda3\lib\site-packages\scenariogeneration\xosc\xosc_reader.py", line 208, in ParseOpenScenario
    return Scenario.parse(loaded_xosc)

  File "C:\Users\user\Anaconda3\lib\site-packages\scenariogeneration\xosc\scenario.py", line 119, in parse
    entities = Entities.parse(element.find('Entities'))

  File "C:\Users\user\Anaconda3\lib\site-packages\scenariogeneration\xosc\entities.py", line 72, in parse
    scenario_objects.append(ScenarioObject.parse(object))

  File "C:\Users\user\Anaconda3\lib\site-packages\scenariogeneration\xosc\entities.py", line 230, in parse
    return ScenarioObject(name, entityobject,controller)

UnboundLocalError: local variable 'entityobject' referenced before assignment

.xosc file in attachment (as .txt format)

untitled00.txt

MandolinMicke commented 2 years ago

Interesting... Will look into it hopefully next week.