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

Better error message when passing in unknown scene #977

Merged
merged 1 commit into from
Feb 6, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions ai2thor/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,19 +629,11 @@ def reset(self, scene=None, **init_params):
# scenes in build can be an empty set when GetScenesInBuild doesn't exist as an action
# for old builds
if self.scenes_in_build and scene not in self.scenes_in_build:

def key_sort_func(scene_name):
m = re.search(
r"FloorPlan[_]?([a-zA-Z\-]*)([0-9]+)_?([0-9]+)?.*$", scene_name
)
last_val = m.group(3) if m.group(3) is not None else -1
return m.group(1), int(m.group(2)), int(last_val)

raise ValueError(
"\nScene '{}' not contained in build (scene names are case sensitive)."
"\nPlease choose one of the following scene names:\n\n{}".format(
scene,
", ".join(sorted(list(self.scenes_in_build), key=key_sort_func)),
", ".join(sorted(list(self.scenes_in_build))),
)
)

Expand Down