G29Py

raw JSON →
0.0.14 verified Sat May 09 auth: no python

Python driver for Logitech G29/G920 steering wheel and pedals. Provides a simple interface to read wheel angle, pedal positions, button states, and force feedback. Version 0.0.14, updated sporadically.

pip install g29py
error AttributeError: module 'g29py' has no attribute 'G29'
cause Wrong import path. The class is in the g29 submodule.
fix
Use 'from g29py.g29 import G29'.
error hidapi.HIDException: Failed to open device
cause Insufficient permissions to access the HID device, or wheel not plugged in.
fix
Run as root/sudo, or add udev rules. Verify wheel is connected and in PS4/PC mode.
error OSError: [Errno 16] Device or resource busy
cause Another process (like a game) is already using the wheel.
fix
Close any program that may have claimed the HID interface.
gotcha On Linux, you may need root permissions or udev rules to access the HID device. Without proper permissions the init() call will fail silently.
fix Run script with sudo or add a udev rule (see repository README).
deprecated The function 'get_steering()' returns value in range [-1.0, 1.0] but older documentation mentioned degree angles.
fix Multiply by the max rotation angle (e.g., 900) to get degrees.
gotcha Force feedback (FFB) requires calling wheel.set_ffb() after each poll cycle, not just once. Many users forget and wonder why no force is felt.
fix Call wheel.set_ffb(strength) inside the loop after poll().

Initialize G29, poll data, and print steering wheel angle and throttle position.

import time
from g29py.g29 import G29
wheel = G29()
if wheel.init():
    print('Wheel connected')
    for _ in range(50):
        wheel.poll()
        print(f"Angle: {wheel.get_steering():.2f}, Throttle: {wheel.get_throttle():.2f}")
        time.sleep(0.05)
    wheel.close()
else:
    print('Failed to initialize G29')