A plethora of Python OSC modules - which one to use?

For anyone else who runs across this stackoverflow question every time they're looking for a python OSC implementation and who needs a working OSC implementation for Python 3 – I can confirm that osc4py3 works well and is well documented.

My survey results from Jan 22 2018:

pyOSC: does not seem to be maintained and I could not find a working Python3 version, some links I found to versions that claimed to be updated for python3 were broken.

aiosc: worked in testing (and seemed like a cool implementation) but for some reason it failed with a "Too many open files" error after a few seconds at the bandwidth I needed.

osc4py3: installed with pip, worked well, and gave me zero problems with around a thousand messages per second, as long as I made sure to call osc_process() after every message.

There may be another OSC version out there that is especially well designed for py3k and that more people are using, but since the field is still a little opaque I felt like this is probably the most appropriate place to share this. I hope it saves someone else a little time.


I have used pyOSC with great success on OSX. The code isn't under much development but this is most likely due to it's stability and simplicity. I briefly tried txosc and it may warrant further testing.

My usage of pyosc is limited but it works well. eg.

import OSC
c = OSC.OSCClient()
c.connect(('127.0.0.1', 57120))   # connect to SuperCollider
oscmsg = OSC.OSCMessage()
oscmsg.setAddress("/startup")
oscmsg.append('HELLO')
c.send(oscmsg)

I've been using pyOSC for years... and "I was there" when it migrated from Python 2 to 3. Well... if I don't remember well, I asked the maintainer in that moment (Artem Baguinski) to do it!

Now, there're two pages that host pyOSC... and, regarding to your question, one of the pages (the oldest) host Python2 version. And the one in Github (that it is old, too, and not developed any more), the Python3 version.

I'm not sure of pyOSC versions, because OSC.py changelog says nothing about Python version. Maybe it was not correctly docummented.

pyOSC 0.3.5 (Python2): https://trac.v2.nl/wiki/pyOSC

pyOSC 0.3.6 (Python3): https://github.com/ptone/pyosc

As ptr said, it's very easy to implement. I use to connect Blender Game Engine with PureData.


This isn't exactly what the question asked, but I think it's something worth mentioning here: one annoying thing about the various Python OSC modules is that most work with either Python 2.x or with Python 3.x but not with both, which means that you might have to change code base and rewrite part of your app in the future.

The only one I found that targets both Python 2.x and 3.x is Pyliblo, which is actually a wrapper for the C library Liblo. Liblo has been specifically tested to work with Pd and SuperCollider (see note at the end of its main page), which is what I mostly cared about when using such libraries... A downside of Liblo is that it's a bit harder to get working on MS Windows because it supports only POSIX threads (pthreads) but not the native win32 thread API, so you need an emulation library as explained at http://liblo.sourceforge.net/README-platforms.html. But you can also compile it with threading disabled on Windows.