ROS Basics in Python Example 2.5 Error

When creating my first ROS program, after I type in “roslaunch my_package my_package_launch_file.launch” into the shell, I keep getting an error saying "
RLException: Invalid roslaunch XML syntax: no element found: line 1, column 0
The traceback for the exception was written to the log file". I tried doing the “chmod +x name_of_file.py” command but it has not worked. Can someone help with what I am doing wrong? Thanks!

Hi did you actually type in “chmod +x name_of_file.py” in the shell? Or did you do this command in your webshell:
chmod +x simple.py.

The error message is for the roslaunch file. May I be able to see it?

It could be possible that the name of the ros NODE is not consistent with the one on your simple.py code. It is usually best practice to compare your code with the given one in the lab manual. It also can be difficult to dissect the problem.

I would recommend double checking the launch file syntax as the error message suggest:

Launch files are tricky to write well. Always remember this neat trick:

<node … then the rest of the syntax>

I recommend that the package name is the same for the launch file and also the node name. If any edits occur to the package always refresh the workspace with catkin_make or rospack profile.

1 Like


Thanks for your help. This is the roslaunch file. I tried removing some of the spaces as seen in other forum posts but I am still receiving the same error

Hi @lharwood ,

The launch file is not the simple.py file. It is the .launch file found in the /launch folder of the ROS package. It is an XML file that looks like:

<launch>
    <node .../>
</launch>

So try to check this file for any inconsistencies and re-build your package.
Source the devel folder before you launch the file.

Let me know if you still have any issues after trying this.

Regards,
Girish

Hi @lharwood,

There is a similar question here:

In a nutshell, try to rewrite the launch file and don’t forget:

rospack profile

Because sometimes ROS does not detect new packages.

Bests,