Exercise 3.1- rosrun line error

I keep getting this error when I try to run the provided rosrun line. If I try to python line I have no trouble completing the task. This is the error I keep receiving.

import: unable to grab mouse ': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9204. from: can't read /var/mail/geometry_msgs.msg import: unable to grab mouse ‘: Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9204.
import: unable to grab mouse ': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9204. /home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts/move_bb8_square.py: line 8: syntax error near unexpected token (’
/home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts/move_bb8_square.py: line 8: `class MoveBB8():’

Hello @claytotr ,

I’ve been testing this exercise and it’s working ok for me. Are you still getting this error? If yes, could you please share some more details about how to reproduce it? Where are you executing the rosrun command? The error you shared in the post seems to be related to a graphical interface, which is pretty weird.

I ended up closing my browser and reopening and that error doesn’t come up anymore. But the rosrun command still does not work. I can get it to work with the python command though. This is the same case with exercide 4.1 Using python instead of rosrun gets it to work.

Hello @claytotr ,

What error are you getting when running the rosrun command?

Hi @claytotr,

I think your python script is being interpreted as a bash script.

Please make sure you have the following shebang code in the first line of your script:

#! /usr/bin/env python3

This code makes the system understand that your script is a python script rather than a bash script.

Please let us know if you still have errors after adding the command above in the first line of your script.

That fixed the error for me, apparently there was an empty line for my first line in the python script I copied, not sure if it’s the way I edited the file we made in the exercise or if it’s something inherent in the way the exercise it written. Anyways I just went into the file itself, deleted the empty first line and saved and it worked perfectly from there.

1 Like