def discover_mujoco()

in mujoco_py/utils.py [0:0]


def discover_mujoco():
    """
    Discovers where MuJoCo is located in the file system.
    Currently assumes path is in ~/.mujoco

    Returns:
    - mujoco_path (str): Path to MuJoCo 2.1 directory.
    """
    mujoco_path = os.getenv('MUJOCO_PY_MUJOCO_PATH')
    if not mujoco_path:
        mujoco_path = join(expanduser('~'), '.mujoco', 'mujoco210')

    # We get lots of github issues that seem to be missing these
    # so check that mujoco is really there and raise errors if not.
    if not exists(mujoco_path):
        message = MISSING_MUJOCO_MESSAGE.format(mujoco_path)
        print(message, file=sys.stderr)
        raise Exception(message)

    return mujoco_path