Syntax error on line 56 of userpy

So, I have this code:

# ------------------------------------------
# 
# 	Project:      VEXcode Project
#	Author:       VEX
#	Created:
#	Description:  VEXcode V5 Python Project
# 
# ------------------------------------------

# Library imports
from vex import *

while True:
    # Stop all motors if axis 3 is at 0
    # if controller_1.axis3.position() == 0:
    #     FrontLeft.stop()
    #     FrontRight.stop()
    #     BackLeft.stop()
    #     BackRight.stop()

    if controller_1.buttonL2.pressing():
        Arm.spin(FORWARD)

    if controller_1.ButtonR2.pressing():
        Arm.spin(REVERSE)

    if controller_1.ButtonL1.pressing():
        Intake.spin(FORWARD)

    if controller_1.ButtonR1.pressing():
        Intake.spin(REVERSE)

    if !(controller_1.ButtonL2.pressing() || controller_1.ButtonR2.pressing()):
        Arm.stop()

    if !(controller_1.ButtonL1.pressing() || controller_1.ButtonR1.pressing()):
        Intake.stop()

    # Move forward/backward
    if controller_1.axis3.value() != 0:
        FrontLeft.set_velocity(controller_1.axis3.position(), PERCENT)
        FrontRight.set_velocity(controller_1.axis3.position(), PERCENT)
        BackLeft.set_velocity(controller_1.axis3.position(), PERCENT)
        BackRight.set_velocity(controller_1.axis3.position(), PERCENT)

        FrontLeft.spin(FORWARD)
        FrontRight.spin(FORWARD)
        BackLeft.spin(FORWARD)
        BackRight.spin(FORWARD)

    # Move left/right
    if (controller_1.axis4.value() > 10 || controller_1.axis4.value() < -10):
        FrontLeft.set_velocity(controller_1.axis4.position(), PERCENT)
        FrontRight.set_velocity(controller_1.axis4.position(), PERCENT)
        BackLeft.set_velocity(controller_1.axis4.position(), PERCENT)
        BackRight.set_velocity(controller_1.axis4.position(), PERCENT)

        FrontLeft.spin(FORWARD)
        FrontRight.spin(REVERSE)
        BackLeft.spin(REVERSE)
        BackRight.spin(FORWARD)

    # Move diagonally
    if ((controller_1.axis3.value() > 10 && controller_1.axis4.value() > 10) || (controller_1.axis3.value() < -10 && controller_1.axis4.value() < -10)):
        FrontLeft.set_velocity((controller_1.axis3.position() + controller_1.axis3.position()/2), PERCENT)
        BackRight.set_velocity((controller_1.axis3.position() + controller_1.axis3.position()/2), PERCENT)

        FrontLeft.spin(FORWARD)
        BackRight.spin(FORWARD)

    # Move diagonally
    if ((controller_1.axis3.value() > 10 && controller_1.axis4.value() < -10) || (controller_1.axis3.value() < -10 && controller_1.axis4.value() > -10)):
        FrontLeft.set_velocity((controller_1.axis3.position() + controller_1.axis3.position()/2), PERCENT)
        BackRight.set_velocity((controller_1.axis3.position() + controller_1.axis3.position()/2), PERCENT)

        FrontLeft.spin(FORWARD)
        BackRight.spin(FORWARD)

    # Turn
    if controller_1.axis1.value() != 0:
        FrontLeft.set_velocity(controller_1.axis1.position(), PERCENT)
        FrontRight.set_velocity(controller_1.axis1.position(), PERCENT)
        BackLeft.set_velocity(controller_1.axis1.position(), PERCENT)
        BackRight.set_velocity(controller_1.axis1.position(), PERCENT)

        FrontLeft.spin(FORWARD)
        FrontRight.spin(REVERSE)
        BackLeft.spin(FORWARD)
        BackRight.spin(REVERSE)

wait(20, msec); #Sleep the task for a short amount of time to
                #prevent wasted resources.
}
}
    

Whenever I download and run the program, I get this error message:
“Traceback (most recent call last):
File “userpy”, line 56
SyntaxError: invalid syntax”

I don’t understand why, that line is typed exactly how it should be. Can anyone help me?

BTW line 56 is the last line of the set velocity block in move left/right

You are mixing C and Python amongst other things
for example, || should be or

google Python logical operators

6 Likes

also, check capitalization on buttons (ie. do not capitalize)
and some code can be simplified, example.
this

        FrontLeft.set_velocity(controller_1.axis3.position(), PERCENT)
        FrontLeft.spin(FORWARD)

can be replace by one line

        FrontLeft.spin(FORWARD, controller_1.axis3.position(), PERCENT)

This is invalid, it’s C again (well, a mixture)

wait(20, msec); #Sleep the task for a short amount of time to
                #prevent wasted resources.
}
}
6 Likes

I found out that I was accidentally mixing C and python. Does putting the velocity percentage in the spin function still work? I though they removed the ability to add that argument, which is why I did set velocity.