Closed ArikGuitarik closed 7 months ago
Hello Arik, your assumption is almost right, but the model
parameter to scenarioFromFile
just overrides whatever is specified in the model
statement in the scenario. The scenario itself needs to have a model
statement to be overridden: otherwise Scenic would not know at which point the world model should be imported (which can matter because some world models require certain global parameters to have been specified before they are imported, in order to configure things like the map to use). We should improve our documentation for that!
Anyway, if you add a model
statement to your scenario then it should work, and in fact it does work in Scenic 3 (with the syntax ported to Scenic 3), but unfortunately it hits a bug in Scenic 2. We can look into fixing that, but in the mean time you might consider porting to Scenic 3: that will bring various benefits such as a more informative error than the misleading ScenicSyntaxError
you're currently getting.
(By the way: your definition of the property foo
in the class Dummy
doesn't do what you expect: it sets the default value of foo
to the class str
. Scenic differs from Python in this respect: the colon introduces a default value, not a type annotation.)
Ah, I see! Thank you so much for the swift and helpful response :)
Versions: Scenic 2.1.0, Python 3.10/3.11
I am trying to use
scenic.scenarioFromFile(..., model=...)
, but it seems to ignore whatever I pass in formodel
.Am I correct in the assumption that it should not matter whether I specify the world model within the scenario file or in the
model
parameter ofscenarioFromFile
?Example:
Running
dummy_script_1.py
succeeds, runningdummy_script_2.py
results in aScenicSyntaxError
.Is there a problem with my code, with my expectation or with Scenic?