python-osc icon indicating copy to clipboard operation
python-osc copied to clipboard

python-osc does not work with uvloop

Open jabdoa2 opened this issue 7 years ago • 5 comments

Standard asyncio loop works fine but uvloop generates an error with this lib:

ERROR : root : '_OSCProtocolFactory' object has no attribute 'dispatcher'
Traceback (most recent call last):
  File "/data/home/jan/cloud/flipper/src/mpf/mpf/commands/game.py", line 217, in __init__
    MachineController(mpf_path, machine_path, vars(self.args)).run()
  File "/data/home/jan/cloud/flipper/src/mpf/mpf/core/machine.py", line 681, in run
    self._run_loop()
  File "/data/home/jan/cloud/flipper/src/mpf/mpf/core/machine.py", line 727, in _run_loop
    raise self._exception['exception']
  File "uvloop/cbhandles.pyx", line 52, in uvloop.loop.Handle._run
  File "uvloop/handles/udp.pyx", line 64, in uvloop.loop.UDPTransport._on_read_ready
  File "/data/home/jan/cloud/flipper/src/python-osc/pythonosc/osc_server.py", line 171, in datagram_received
    _call_handlers_for_packet(data, self.dispatcher)

This seems to be related to passing a class instance as factory to create_datagram_endpoint.

jabdoa2 avatar Jul 10 '18 21:07 jabdoa2

Do you have any snippet you can share to see how the python-osc dispatcher ended up in the uvloop? I've personally never used it but seeing the code might help figure out what's wrong.

attwad avatar Sep 30 '18 20:09 attwad

I think the above already happens with the sample code from your website. Just load and set uvloop before that and you will be able to see it.

jabdoa2 avatar Sep 30 '18 20:09 jabdoa2

I see, any python version/system this was confirmed on?

attwad avatar Sep 30 '18 20:09 attwad

(uvloop says 3.5+, python-osc is 3.4+, just want to make sure this was confirmed on 3.5+ before diving deeper)

attwad avatar Sep 30 '18 20:09 attwad

I tried on 3.5 or 3.6

jabdoa2 avatar Sep 30 '18 20:09 jabdoa2