{"id":24456,"library":"python-osc","title":"python-osc","description":"Pure Python implementation of the Open Sound Control (OSC) protocol, providing both UDP and TCP server and client classes. Version 1.10.2 supports Python >=3.10. Released irregularly with focus on robustness and simplicity.","status":"active","version":"1.10.2","language":"python","source_language":"en","source_url":"https://github.com/attwad/python-osc","tags":["osc","networking","music","real-time"],"install":[{"cmd":"pip install python-osc","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"SimpleUDPClient is in the udp_client submodule, not at package root.","wrong":"from pythonosc import SimpleUDPClient","symbol":"SimpleUDPClient","correct":"from pythonosc.udp_client import SimpleUDPClient"},{"note":"Similar submodule requirement.","wrong":"from pythonosc import SimpleUDPServer","symbol":"SimpleUDPServer","correct":"from pythonosc.udp_server import SimpleUDPServer"},{"note":"Class is OscPacket with capital O, and under osc_packet module.","wrong":"from pythonosc import OSCPacket","symbol":"OSCPacket","correct":"from pythonosc.osc_packet import OscPacket"},{"note":"Located in osc_message submodule.","wrong":"from pythonosc import OscMessage","symbol":"OscMessage","correct":"from pythonosc.osc_message import OscMessage"}],"quickstart":{"code":"from pythonosc.udp_client import SimpleUDPClient\n\nclient = SimpleUDPClient(\"127.0.0.1\", 9000)\nclient.send_message(\"/hello\", [1, 2.0, \"world\"])\nprint(\"Sent OSC message to 127.0.0.1:9000\")","lang":"python","description":"Minimal example to send an OSC message over UDP."},"warnings":[{"fix":"Update server handlers to accept OscMessage object and access arguments via osc_message.params.","message":"In version 1.8.0, the UDP server callback signature changed from (address: str, *osc_args) to (address: str, osc_message: OscMessage). Code using positional args will crash.","severity":"breaking","affected_versions":">=1.8.0"},{"fix":"Use UDP unless you need guaranteed delivery. Check examples in the repository for TCP usage.","message":"TCP server and client are available but require explicit import from pythonosc.tcp_server and pythonosc.tcp_client. They have different APIs (e.g., TCP client uses send_message method but may need manual connection).","severity":"gotcha","affected_versions":"all"},{"fix":"Always build messages using the provided classes (OscMessage, OscBundle) rather than constructing raw byte strings.","message":"The library does not validate OSC compatibility beyond basic packet structure; malformed messages may be silently dropped or raise cryptic errors.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"pip install python-osc","cause":"Library not installed","error":"ModuleNotFoundError: No module named 'pythonosc'"},{"fix":"from pythonosc.udp_client import SimpleUDPClient","cause":"Incorrect import path; SimpleUDPClient is in submodule","error":"ImportError: cannot import name 'SimpleUDPClient' from 'pythonosc'"},{"fix":"Update handler to accept (addr, osc_message) and access arguments via osc_message.params","cause":"Server callback signature changed in v1.8.0; old handler expects (addr, *args) but new one passes (addr, message)","error":"TypeError: handler() takes 2 positional arguments but 3 were given"},{"fix":"Use an IP address string like '127.0.0.1' instead of a hostname","cause":"Client was given a hostname that cannot be resolved","error":"socket.gaierror: [Errno -2] Name or service not known"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}