Controller Print not working

when i put this code into my drive code it immediately kicks me out as soon as i start it any suggestions, code is below we are using python

con.screen.set_cursor(1, 1)
con.screen.print_((motor_9.temperature(vex.PercentUnits.PCT)))
con.screen.set_cursor(2, 1)
con.screen.print_((motor_10.temperature(vex.PercentUnits.PCT)))

Did you declare your controller as con?

@RoboKnight yes, that is what it is defined as.

Any chance you can set your project to public (under the Options gear at the top right) and provide a link to it?

@John_TYler

https://www.robotmesh.com/studio/5d5460ff8055570c7b78ee61

Your indentation is wrong. Python cares about formatting. Lines 63-99 (excepting lines 70-73) aren’t indented far enough to be part of the while True: on line 62.

The reason the error shows up when you put the controller printing stuff in is lines 70-73 are indented properly, so there is no syntax error until you add them. With or without them you have a logic error because lines 76-99 aren’t indented to be part of the while on line 62. Additionally, you will find that there’s an additional logic error in calling two controller prints back-to-back, as the controller ignores messages for 50ms after receiving a message.

The easy way to indent several lines at once is to select all of them then hit the Tab key. It will indent all lines with highlighted text (as long as parts of more than one line are selected). The same can be done for undoing an indent, but with Shift+Tab instead of Tab.

@John_TYler But even when it is spaced correctly it still kicks me right out of the code

Looking at it right now, the spacing is not correct. You made lines 70-73, which were correct, match the rest of lines 63-99, which were incorrect. You made the wrong fix.