pylibftdi
raw JSON → 0.24.0 verified Mon Apr 27 auth: no python
Pythonic interface to FTDI devices using libftdi. Current version 0.24.0, requires Python >=3.10. Released under BSL-1.0, maintained on GitHub. Cadence: irregular, with recent releases in 2024.
pip install pylibftdi Common errors
error pylibftdi.exc.FtdiError: libusb_open() failed ↓
cause No permission to access USB device or device not connected.
fix
Ensure device is plugged in and you have udev rules set. Or run with sudo (temporary).
error pylibftdi.exc.FtdiError: FTDI device not found ↓
cause The specified device_id or serial does not match any connected FTDI device.
fix
List devices with pylibftdi.Driver().list_devices() to see available serials.
error AttributeError: module 'pylibftdi' has no attribute 'FtdiDriver' ↓
cause FtdiDriver was removed in pylibftdi 0.22.0.
fix
Use pylibftdi.Driver instead.
Warnings
breaking pylibftdi dropped support for Python <3.10 in version 0.24.0. ↓
fix Upgrade Python to 3.10+ or pin pylibftdi to 0.23.x for older Python.
deprecated The 'baudrate' argument is deprecated in some contexts; use 'baud' instead. ↓
fix Replace baudrate=... with baud=... in Device constructor.
gotcha On Linux, you must have udev rules or run with sudo to access FTDI devices. Missing rules cause 'FtdiError: libusb_open() failed'. ↓
fix Add udev rule: SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"
gotcha When using BitBangDevice, note that pin numbering is bit index, not physical pin. Miswiring is common. ↓
fix Check datasheet: e.g., for FT232R, D0..D7 correspond to pins 1-8 (CBUS0-3 in bitbang mode).
Imports
- BitBangDevice wrong
from pylibftdi.device import BitBangDevicecorrectfrom pylibftdi import BitBangDevice - Device wrong
from pylibftdi.driver import FtdiDrivercorrectfrom pylibftdi import Device - Driver
from pylibftdi import Driver
Quickstart
import os
import time
from pylibftdi import Device
with Device(mode='t', device_id=os.environ.get('DEVICE_SERIAL', '')) as dev:
dev.write(b'hello')
time.sleep(0.1)
print(dev.read(10))