Use importlib.resources.files for card template path access #589
+1
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this does
Replace importlib.resources.path with importlib.resources.files to properly handle package resource paths without requiring context manager. This fixes the FileNotFoundError caused by incorrect context manager handling.
How it was tested
I tested it trying to record dataset in sim using this script
control_sim_robot_no_env.py
from https://github.com/s1lent4gnt/lerobot/blob/lilkm/joystick-control-sim-robot-no-env/lerobot/scripts/control_sim_robot_no_env.py. (NOTE: You need to make the change from this PR to check that is working.)Using this command
python lerobot/scripts/control_sim_robot_no_env.py record \ --robot-path lerobot/configs/robot/koch_sim.yaml \ --fps 30 \ --root data \ --repo-id ${HF_USER}/moss_test \ --warmup-time-s 1 \ --display-cameras 0 \ --episode-time-s 40 \ --reset-time-s 10 \ --num-episodes 2 \ --push-to-hub 1 \ --assign_rewards 1 \ --single-task test_sim
You need a joystick/gamepad (xbox or ps5) to control the robot!