ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
0

/usr/bin/env: ‘python\r’: No such file or directory

asked 2021-08-30 08:29:22 -0500

Victor_Kash gravatar image

updated 2021-08-30 09:46:22 -0500

gvdhoorn gravatar image

When using WSL to write python code and then trying to run it from rosrun, this error code is encountered.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2021-08-30 08:31:19 -0500

Victor_Kash gravatar image

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
edit flag offensive delete link more

Comments

3

Or use an editor which stores files in the target format.

gvdhoorn gravatar image gvdhoorn  ( 2021-08-30 09:46:53 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-08-30 08:29:22 -0500

Seen: 3,584 times

Last updated: Aug 30 '21