AttributeError: 'wpilib._wpilib.XboxController' object has no attribute 'getY'

We tried to deploy our tank drive code and it threw the error of not having a getY function multiple times. We made sure that it was not the controller as we tried xbox controllers from xbox 360 and xbox 1. This code still worked fine on robot.py-ctre-2021, but does not seem to work as we updated to 2022. Currently, we have imported…
import wpilib import ctre

self.controller = wpilib.XboxController(0) self.controller.getY(self.controller.Hand.kLeftHand)

The error given was
Traceback (most recent call last): File "/usr/local/lib/python3.10/site-packages/wpilib/_impl/start.py", line 124, in _start self.robot.startCompetition() File "/home/lvuser/py/robot.py", line 38, in teleopPeriodic self.controller.getY(self.controller.Hand.kLeftHand) * -1, File "/usr/local/lib/python3.10/site-packages/wpilib/_impl/start.py", line 124, in _start self.robot.startCompetition() File "/home/lvuser/py/robot.py", line 38, in teleopPeriodic self.controller.getY(self.controller.Hand.kLeftHand) * -1, AttributeError: 'wpilib._wpilib.XboxController' object has no attribute 'getY'

When running “py -3 -m robotpy_installer list” this was the output…
` * numpy 1.22.1

  • pip                      21.2.4
    
  • pynetworktables          2021.0.0
    
  • pyntcore                 2022.2.1.2
    
  • robotpy                  2022.0.33
    
  • robotpy-cscore           2022.0.2
    
  • robotpy-ctre             2022.0.5
    
  • robotpy-hal              2022.2.1.1
    
  • robotpy-libgfortran4     7.3.0+r1
    
  • robotpy-navx             2022.0.1
    
  • robotpy-openblas         0.3.19+r1
    
  • robotpy-opencv           4.5.5+r1
    
  • robotpy-opencv-core      4.5.5+r1
    
  • robotpy-wpilib-utilities 2022.0.1
    
  • robotpy-wpimath          2022.2.1.4
    
  • robotpy-wpiutil          2022.2.1.1
    
  • setuptools               58.1.0
    
  • wpilib                   2022.2.1.5`

The API changed this year.
You may want to check: XboxController (WPILib API 2022.2.1)

The new method is getLeftY() or getRightY() the hand parameter has been dropped.

Thank you so much! That did the trick.

The python API for XboxController is at XboxController — RobotPy WPILib 2022.2.1.5 documentation, but it’s basically the same as the docs linked above.