Getting error when I try to run move_bb8_square.py

I am keep getting
user:~/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts$ rosrun move_bb8_pkg move_bb8_square.py

File “/home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts/move_bb8_square.py”, line 11
self.cmd = Twist()
^
IndentationError: unexpected indent
I updated permission for execute and I tried to re-copy and past the code that they gave to me but still I don’t understand why this is happening. Only thing I did was just copy the code they gave and paste it on new file with vi

Hello @gigm2121 ,

There seems to be an indentation error in line 11, as the error message indicates. If you send a screenshot of your code we might be able to see it.

1 Like

Thanks for your reply! I fixed it, and the problem was since Python’s quite sensitive with indentation, while I was pasting the code to the file there was some kind of unknown indent also added, and that caused a problem. So I made a new Python file at VSCode pasted the code and moved that file into the Linux directory and worked!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.