# Protocol communication beginner - how to use OSC to output from a python program to processing sketch?

**URL:** <https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285>\
**Category:** Libraries\
**Created:** [May 25, 2020, 4:35pm UTC](https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285 "2020-05-25T16:35:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)\
**Post date:** [May 25, 2020, 4:35pm UTC](https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285/1 "2020-05-25T16:35:39Z")

</div>

Hi, I’m a total beginner in using OSC, I don’t fully understand how it works even. Could someone please explain how I could output values from a Python program and receive them in my processing sketch. For example, a python program which calculates the x,y,w,h parameters of an ellipse based on some arbitrary algorithm and outputs it via OSC to processing, where I receive the values and update the parameters of my ellipse in the sketch.

I would really appreciate a full explanation, with any useful links and resources to get going. Thanks!

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [May 25, 2020, 11:46pm UTC](https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285/2 "2020-05-25T23:46:31Z")

</div>

Is your Python program running in Processing Python mode?

To understand how OSC works, you should run the server and client demos both in Processing as two different sketches to see the library in action. Get this working first and understand how it works (or the intended behavior before proceeding further). Next, investigate an OSC version on the python side (Start [here](https://stackoverflow.com/questions/22135511/a-plethora-of-python-osc-modules-which-one-to-use)) I have never tried this but I am willing to bet it will work.

As an alternative, you can run a flask application and setup a processing server and you will use simple HTTP. This is more standard and it should work off the bat.

Kf

---

<div class="post-metadata">

**Author:** ![rkk16](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rkk16](https://discourse.processing.org/u/rkk16)\
**Post date:** [May 26, 2020, 9:48pm UTC](https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285/3 "2020-05-26T21:48:28Z")

</div>

Thanks. Will look into it, um it’s a Python program running a ML model with output probabilities. I want to send the values of these probabilities to a port via OSC and receive them in Processing.

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [May 28, 2020, 3:18pm UTC](https://discourse.processing.org/t/protocol-communication-beginner-how-to-use-osc-to-output-from-a-python-program-to-processing-sketch/21285/4 "2020-05-28T15:18:56Z")

</div>

See also:

> **[mikkelmedm/PythonToProcessingAndBack](https://github.com/mikkelmedm/PythonToProcessingAndBack)**
>
> Sending OSC messages between python and Processing - mikkelmedm/PythonToProcessingAndBack

and previous discussion of using Python mode (Processing.py) for OSC – which I don’t think is what you want, but might be relevant depending on your goals:

- [https://forum.processing.org/two/discussion/15995/receive-osc](https://forum.processing.org/two/discussion/15995/receive-osc)
