/usr/bin/env: ‘python\r’: No such file or directory
When using WSL to write python code and then trying to run it from rosrun, this error code is encountered.
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
When using WSL to write python code and then trying to run it from rosrun, this error code is encountered.
The problem are your line ending characters. Your file was created or edited on a Windows system and uses Windows/DOS-style line endings (CR+LF), whereas Linux systems like Ubuntu require Unix-style line endings (LF).
There is a simple tool that can convert the two different styles for you called dos2unix.
Install it by running
sudo apt install dos2unix
After that, you can convert files in either direction using one of the commands
dos2unix /PATH/TO/YOUR/WINDOWS_FILE
unix2dos /PATH/TO/YOUR/LINUX_FILE
Example:
dos2unix tf_list_conversion.py
Asked: 2021-08-30 08:29:22 -0600
Seen: 8,499 times
Last updated: Aug 30 '21