leggedrobotics / rsl_rl

Fast and simple implementation of RL algorithms, designed to run fully on GPU.
Other
505 stars 156 forks source link

fix: error caused by non UTF-8 characters in git diff #31

Open fan-ziqi opened 1 month ago

fan-ziqi commented 1 month ago

When there are non-UTF-8 characters in git diff, the following error will be reported:

Traceback (most recent call last):
  File "/home/ubuntu/workspaces/IsaacLab/source/standalone/workflows/rsl_rl/train.py", line 135, in <module>
    main()
  File "/home/ubuntu/workspaces/IsaacLab/source/standalone/workflows/rsl_rl/train.py", line 127, in main
    runner.learn(num_learning_iterations=agent_cfg.max_iterations, init_at_random_ep_len=True)
  File "/home/ubuntu/anaconda3/envs/isaaclab/lib/python3.10/site-packages/rsl_rl/runners/on_policy_runner.py", line 160, in learn
    git_file_paths = store_code_state(self.log_dir, self.git_status_repos)
  File "/home/ubuntu/anaconda3/envs/isaaclab/lib/python3.10/site-packages/rsl_rl/utils/utils.py", line 85, in store_code_state
    f.write(content)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 1007-1025: ordinal not in range(128)

So need to add encoding="utf-8"