Registry / http-networking / phidget22

phidget22

JSON →
library1.25.20260408pypypi✓ verified 84d ago

Phidget22 is the official Python library for working with Phidgets in Python applications. It provides lightweight bindings to the native phidget22 library. The current version is 1.25.20260408, and the library is actively maintained with frequent updates, often multiple times per year, bundling native libraries for major operating systems.

pip install phidget22
INSTALL
IMPORT
SIG · PHIDGET22
P
phidget22
http-networkingpythonv1.25.20260408
Install
1.7s avg
Import
14ms
Disk
18MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.25.20260408 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.011s · 19.2MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.018s · 22MB
18MB installed
● package 18MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

*
from Phidget22.Phidget import *
from Phidgets.Phidget import *
Phidget22 uses 'Phidget22' as the top-level package, distinguishing it from the older Phidget21 library which used 'Phidgets'.
TemperatureSensor
from Phidget22.Devices.TemperatureSensor import TemperatureSensor
Device-specific classes are found under `Phidget22.Devices`. It's common to import specific device classes for clarity.

This quickstart initializes a `TemperatureSensor` object, registers event handlers for attachment, detachment, and temperature changes, and then waits for a sensor to be connected. It prints temperature readings to the console as they occur. The program includes basic error handling and a clean shutdown.

import time from Phidget22.Phidget import * from Phidget22.Devices.TemperatureSensor import * def onAttachHandler(self): print("Attach Event: " + self.getDeviceName()) def onDetachHandler(self): print("Detach Event: " + self.getDeviceName()) def onTemperatureChangeHandler(self, temperature): print("Temperature: " + str(temperature) + " °C") def main(): try: # Create your Phidget channels temperatureSensor = TemperatureSensor() # Set event handlers temperatureSensor.setOnAttachHandler(onAttachHandler) temperatureSensor.setOnDetachHandler(onDetachHandler) temperatureSensor.setOnTemperatureChangeHandler(onTemperatureChangeHandler) # Open your Phidget and wait for attachment print("Waiting for Phidget TemperatureSensor to be attached...") temperatureSensor.openWaitForAttachment(5000) print("Press Ctrl+C to Exit\n") while(True): time.sleep(1) except PhidgetException as e: print("Phidget Exception: " + str(e.code) + " - " + e.details) except KeyboardInterrupt: pass finally: try: temperatureSensor.close() except PhidgetException as e: print("Error closing Phidget: " + str(e.code) + " - " + e.details) if __name__ == '__main__': main()
Debug
Known issues
breakingUpgrading from Phidget21 to Phidget22 involves significant API changes. Object structures have been broken into more modular components, property and method names have changed (e.g., `open()` instead of `open()`), and outputs/settings are no longer persistent across channel opens/closes.
fix
Review the 'Upgrading Code from Phidget21 to Phidget22' guide in the official Phidgets documentation and rewrite affected parts of your application, focusing on the new modular object model and event-driven programming. Ensure you are importing from `Phidget22` and not `Phidgets`.
affects: All versions of Phidget22 when migrating from Phidget21
gotchaHID USB Phidgets on macOS (legacy devices) require special driver installation or the Phidget Control Panel to function correctly, even with the Python library installed via pip. Newer USB and VINT Phidgets do not have this requirement.
fix
Install the necessary macOS libraries or the Standalone Control Panel from the Phidgets website. Check your Phidget's product page specifications to determine its USB stack.
affects: All versions of Phidget22 on macOS with HID USB Phidgets
gotchaPhidgets require specific addressing parameters (e.g., `DeviceSerialNumber`, `Channel`, `IsHubPortDevice`) for unique identification. Incorrect or missing parameters are a common cause of devices not attaching or 'Timed Out' errors.
fix
Double-check that the addressing parameters match your physical Phidget device and its connection. If unsure, try omitting parameters with `openWaitForAttachment()` to allow the library to find any available device of the specified class.
affects: All
gotchaMany Phidgets, especially certain VINT devices or hubs, require external power to operate correctly. A lack of power can lead to 'Device Not Attached' or 'Timed Out' errors.
fix
Ensure that your Phidgets and any connected VINT Hubs have the appropriate external power supply connected and functioning.
affects: All
gotchaThe Phidget Network Server (used for remote Phidgets) can be blocked by firewalls, preventing Python applications from connecting to remote devices or discovering them.
fix
Add `NetworkServer.exe` (typically in `C:\Program Files\Phidgets\Phidget22\`) to your Windows Defender Firewall exceptions, or configure your firewall to allow connections for the Phidget Network Server.
affects: All (when using network server)
Errors
Common errors & fixes
ImportError: No module named 'Phidget22' (or similar for submodules like Phidget22.Devices)
The Phidget22 Python package is either not installed in the active Python environment, or the import statement refers to the old Phidget21 library (e.g., 'Phidgets' instead of 'Phidget22').
fix
Ensure `phidget22` is installed in your environment (`pip install phidget22`). Verify your import statements use `from Phidget22...` and not `from Phidgets...`. If using a virtual environment, ensure it's activated.
PhidgetException: TIMED_OUT (or a similar message containing 'Timed Out')
The Phidget device could not be opened within the specified timeout. Common reasons include the device not being plugged in, incorrect addressing parameters (serial number, channel, hub port), the device being busy (opened by another program), or a power issue.
fix
Verify the Phidget is physically connected, powered on (if needed), and not already in use by another application (e.g., the Phidget Control Panel). Double-check any `DeviceSerialNumber`, `Channel`, or `HubPort` parameters you've set, or increase the `openWaitForAttachment()` timeout.
PhidgetException: BUSY (or a similar message containing 'Resource Busy')
The Phidget device you are trying to open is already open by another process or application. This could be the Phidget Control Panel, another instance of your program, or a different application.
fix
Close any other programs or instances that might be using the Phidget, including the Phidget Control Panel. If you suspect a background process, check your operating system's task/activity monitor.
PhidgetException: DEVICE_NOTATTACHED (or a similar message containing 'Device Not Attached')
The program is attempting to interact with a Phidget channel that is not currently attached or has become detached. This can occur if the device was unplugged, lost power, or the `openWaitForAttachment()` call failed or was not used, and the program tried to access the device before it was ready.
fix
Ensure the device is firmly connected and powered. Use `openWaitForAttachment()` with a sufficient timeout before attempting to read from or write to the device. Implement `onAttachHandler` and `onDetachHandler` to manage the device's state.
Upgrade
Version history
1.25.20260408latest on PyPI · released Apr 8, 2026
Audit
Dependencies
Phidget22 native libraryrequiredThe Python wrapper provides lightweight bindings to the native Phidget22 C library. For Windows, Linux, and macOS, the native library is bundled with the pip package. For other operating systems, or for specific hardware like HID USB Phidgets on macOS, the native library or drivers may need separate installation.
Agent activity
4 hits · last 30 days
node
4
Resources
phidget22 — pip install phidget22 · libregistry