Skip to content

Commit 32da198

Browse files
committed
Use warning instead of assertions
to not crash the whole thing just because an XML file is missing. TODO: fix missing files I think when installing with pip -e, some files are not copied over... figure out what to do then...
1 parent 7ac780b commit 32da198

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

python/rcsss/__init__.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pathlib
44
import site
55
from typing import TypedDict
6+
from warnings import warn
67

78
from gymnasium import register
89
from rcsss import camera, control, envs, sim
@@ -24,12 +25,15 @@ class SceneData(TypedDict):
2425
}
2526
for path in (pathlib.Path(site.getsitepackages()[0]) / "rcsss" / "scenes").glob("*")
2627
}
27-
# available mujoco scenes
28-
for scene in scenes.values():
29-
assert scene["xml"].exists()
30-
assert scene["mjb"].exists()
31-
for urdf in scene["urdfs"].values():
32-
assert urdf.exists()
28+
29+
for _ in scenes.values():
30+
if not _["xml"].exists():
31+
warn(f"Missing XML scene file {str(_['xml'])}")
32+
if not _["mjb"].exists():
33+
warn(f"Missing mjb scene file {str(_['mjb'])}")
34+
for urdf in _["urdfs"].values():
35+
if not urdf.exists():
36+
warn(f"Missing urdf file {str(urdf)}")
3337

3438
# make submodules available
3539
__all__ = ["__doc__", "__version__", "common", "hw", "sim", "camera", "scenes", "control", "envs"]

0 commit comments

Comments
 (0)