Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scenic.core.errors.ScenicParseError: invalid syntax. Perhaps you forgot 'new'? #12

Open
caixxuan opened this issue Mar 10, 2024 · 2 comments

Comments

@caixxuan
Copy link

when I type:
python scripts/run.py --agent_cfg sac.yaml --scenario_cfg scenic.yaml --num_scenario 1 --mode train_scenario

I got a issue:
scenic.core.errors.ScenicParseError: invalid syntax. Perhaps you forgot 'new'?

@caixxuan
Copy link
Author

Traceback (most recent call last):
File "scripts/run.py", line 78, in
runner.run()
File "/home/oem/SafeBench/safebench/scenic_runner.py", line 327, in run
self._init_scenic(config)
File "/home/oem/SafeBench/safebench/scenic_runner.py", line 142, in _init_scenic
self.scenic = ScenicSimulator(config.scenic_file, self.scenario_config)
File "/home/oem/SafeBench/safebench/util/scenic_utils.py", line 131, in init
self.scenario = errors.callBeginningScenicTrace(
File "/home/oem/SafeBench/Scenic/src/scenic/core/errors.py", line 282, in callBeginningScenicTrace
return func()
File "/home/oem/SafeBench/safebench/util/scenic_utils.py", line 132, in
lambda: translator.scenarioFromFile(self.args.scenicFile,
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/translator.py", line 142, in scenarioFromFile
return _scenarioFromStream(
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/translator.py", line 172, in _scenarioFromStream
compileStream(stream, namespace, compileOptions, filename)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/translator.py", line 289, in compileStream
scenic_tree = parse_string(source, "exec", filename=filename)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 107, in parse_string
return parser.parse(mode if mode == "eval" else "file")
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 149, in parse
res = getattr(self, rule)()
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 586, in file
(a := self.statements(),)
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 667, in statements
(a := self._loop1_4())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 10474, in _loop1_4
(statement := self.statement())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 693, in statement
(a := self.simple_stmts())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 736, in simple_stmts
(a := self.simple_stmt())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 786, in simple_stmt
(assignment := self.assignment())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 1140, in assignment
(b := self._tmp_18())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 10695, in _tmp_18
(star_expressions := self.star_expressions())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 4465, in star_expressions
(a := self.star_expression())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 4507, in star_expression
(expression := self.expression())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 4338, in expression
(self.invalid_scenic_instance_creation())
File "/home/oem/anaconda3/envs/safebench/lib/python3.8/site-packages/pegen/parser.py", line 66, in memoize_wrapper
tree = method(self, *args)
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 8763, in invalid_scenic_instance_creation
return self . raise_syntax_error_known_range ( "invalid syntax. Perhaps you forgot 'new'?" , n , s );
File "/home/oem/SafeBench/Scenic/src/scenic/syntax/parser.py", line 527, in raise_syntax_error_known_range
raise self._build_syntax_error(message, start, end)
scenic.core.errors.ScenicParseError: invalid syntax. Perhaps you forgot 'new'?
sac.yaml scenic.yaml failed!

@javyduck
Copy link
Collaborator

Hi,

Apologies for the delayed response. I doubt it is due to the version of Scenic?

But I would prefer to try running the Scenic script from my updated repository for Scenic at https://github.com/javyduck/ChatScene? The environment settings are the same, and I will keep updating that repo for Scenic intergration, so feel free to have a try.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants