Ex 2.1: Python Script indentation incorrect on IDG after copying the code into robot_control_class.py

Python Robotics Ex 2.1 - I have copied the given python code into robot_control_class.py , but the indentation on the IDE is not right (see the pic). As a result, python pyscript1.py does not work.

What correction should I make to have the right script indentations on the IDE? Thanks.

Hi @MarkSix11,

if you reload the page, copy and paste it again, does the problem persist?

If so, could you try creating a file on your own computer, paste that content and upload the code created locally?

Please let us know which solution worked, if any works.

Hi Ralves,

Thanks for your suggestions. It did NOT work when I copied the code to a pdf/WORD file, then pasted the code from pdf/WORD file to visual editor (that is, INSERT after vi robot_control_class.py).

My temporary solution is: copy and paste the code directly to IDE. Although this works, I still want to figure out how to resolve the identation issue when using the visual editor. Thanks.


Hi @MarkSix11,

I’m happy to hear that it works when you copy it directly into the IDE (Code Editor), and it only fails in vim.

I really don’t know yet why it failed with vi for you. The only thing that comes to mind is that it may be related some language settings of your browser, but I’m not really sure.