Encoding issue: Coding on Windows 7 and transferring to Linux and my scripts are not working. What is causing this issue?

asked 2016-11-17 10:16:37 -0500

RAS_Trent gravatar image

updated 2016-11-17 13:52:21 -0500

I've been coding some of my launch files, scripts, etc in Windows 7 and I've noticed that there is some encoding issue that I can only resolve by recopying the code (I made in Windows) into new files that I create on my Linux hardware.

I verified that my scripts and launch files work by testing them on my Linux hardware after remaking them.

I have been using Notepad++ and Eclipse on Windows 7 fyi. And I'm using ROS Indigo.

Edit with ERRORS:

  • Using roslaunch to start a python file created in Windows: "No such file or directory" even though the exact file is where it should be. Verified this was an encoding problem by remaking the file in Linux.

  • Trying to use a shell file to start a launch file (launch file works): "No such file or directory. XYZ is not a launch file name"

edit retag flag offensive close merge delete



Some text editors will use fancy (unicode) quotes that aren't expected by roslaunch; and windows and Linux use slightly different newline characters. The dos2unix program can convert line endings, but I'm not aware of anything that converts quotes.

ahendrix gravatar image ahendrix  ( 2016-11-17 10:31:57 -0500 )edit

It would also be helpful if you could post the actual error message that you get, so that we don't have to guess at your issue.

ahendrix gravatar image ahendrix  ( 2016-11-17 10:32:56 -0500 )edit

I would also check newlines. Linux uses Unix-style (\n), while Windows uses .. Windows-style (\r\n). The python interpreter doesn't like it very much if you mix them, and weird things can happen. On Ubuntu, the fromdos and todos utilities can help you convert them.

gvdhoorn gravatar image gvdhoorn  ( 2016-11-17 11:25:10 -0500 )edit

ahendrix, I posted the kinds of errors I would see.

I had similar issues with rosrun and some other commands that seemed to be fixed by using new files.

RAS_Trent gravatar image RAS_Trent  ( 2016-11-17 13:53:05 -0500 )edit