[Bug] Won't run after correct code

This is an error report.


Screenshot of the error


Error details

I was adding permissions to the move_bb8_square.py file, following the lesson, then when i try to copy past the code from the instructions into the shell it gives me an error. Not sure what's going on, I'm 99% sure I have it right.

It’s an issue with indentation.
Python is very sensitive about that, and you can see the red marks in the IDE.

I’d say that when you copy and paste, your system is for some reason adding tabs or spaces where it shouldn’t. Normally, this can be fixed in two ways:

  1. Use a Python indentation normalization tool that can detect these inconsistencies. I’d suggest passing the code to ChatGPT and asking it to fix the indentation, since it’s probably just a mix of tabs and spaces somewhere.
  2. Fix it manually: select all the code, press SHIFT+TAB until all the lines are aligned to the left, and then add the correct indentation for each line of code.

You should not paste into the shell; you should paste into the IDE directly.

Please copy the code again, delete the file contents of the file from the IDE, and paste into the file from the IDE.

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