Skip to content
Snippets Groups Projects
Commit cbc6ca8e authored by Abhishek Kadian's avatar Abhishek Kadian
Browse files

Handle the case when pyrobot is not installed

parent 425bf313
No related branches found
No related tags found
No related merge requests found
# TODO(akadian): come up with better module structure
from habitat.sims.pyrobot.pyrobot import PyRobot
def _try_register_pyrobot():
try:
import pyrobot
has_pyrobot = True
except ImportError as e:
has_pyrobot = False
pyrobot_import_error = e
if has_pyrobot:
from habitat.sims.pyrobot.pyrobot import PyRobot
else:
@registry.register_simulator(name="PyRobot-v0")
class PyRobotImportError(Simulator):
def __init__(self, *args, **kwargs):
raise pyrobot_import_error
......@@ -8,7 +8,7 @@ from habitat.core.logging import logger
from habitat.core.registry import registry
from habitat.core.simulator import Simulator
from habitat.sims.habitat_simulator import _try_register_habitat_sim
from habitat.sims.pyrobot.pyrobot import PyRobot
from habitat.sims.pyrobot import _try_register_pyrobot
def make_sim(id_sim, **kwargs):
......@@ -21,3 +21,5 @@ def make_sim(id_sim, **kwargs):
_try_register_habitat_sim()
_try_register_pyrobot()
g
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment