Skip to content

Cant get Basic Server Demo to work with TouchOSC #131

@HarlekinSimplex

Description

@HarlekinSimplex

Hi,

I just used the following sample code to test the server with my TouchOSC Surface:

from pythonosc.dispatcher import Dispatcher
from pythonosc.osc_server import BlockingOSCUDPServer

def print_handler(address, *args):
    print(f"{address}: {args}")

def default_handler(address, *args):
    print(f"DEFAULT {address}: {args}")

dispatcher = Dispatcher()
dispatcher.map("/scene/*", print_handler)
dispatcher.set_default_handler(default_handler)

ip = "127.0.0.1"
port = 8006

server = BlockingOSCUDPServer((ip, port), dispatcher)
server.serve_forever()  # Blocks forever

TouchOSC sends to port 8006 and receives on port 9006.
Sending messages to TouchOSC works nicely but the server does not give any output.
Regardless what I set as the address used by the dispatcher.
Neither the function to handle the set mapping nor the default handler seem to be called.

PyCharm gives two warnings for the disptcher calls:
Expected type 'FunctionType', got '(address: Any, args: Tuple[Any, ...]) -> None' instead
May that be a hint what is wrong?

Im running that code on Windows10 Pro using PyCharm.
What am I doing wrong here?

Cheers
Harlekin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions