I stumbled across a a very strange problem. If I try to send a named tuple from one coroutine to another, the tuple never arrives to the remote coroutine (no error is printed). However, if a simple tuple is used, the message is sent correctly.
I think that the problem is not present on the channels, because I had some named tuples working fine with channels and I don't remember having any problems.
Tuple (or any object) can't be sent over network; they have to be serialized and the remote side then have to deserialize (which means the definitions available at both sides with proper name). Following programs should work.
Testa.py:
importasyncoro.disasyncoroasasyncoroimportcollectionsTEST=collections.namedtuple('TEST',['num1','num2'])defhello1(coro=None):coro.register()whileTrue:msg=yieldcoro.receive()ifisinstance(msg,str):# in this case, assume serialized data (in a generic case this needs to be modified)msg=asyncoro.deserialize(msg)print('%s / %s'%(type(msg),msg))scheduler=asyncoro.AsynCoro(node="127.0.0.1",udp_port=51350,tcp_port=10000,name="A")asyncoro.Coro(hello1)
Hi!
I stumbled across a a very strange problem. If I try to send a named tuple from one coroutine to another, the tuple never arrives to the remote coroutine (no error is printed). However, if a simple tuple is used, the message is sent correctly.
I think that the problem is not present on the channels, because I had some named tuples working fine with channels and I don't remember having any problems.
Testa.py (server):
Testb.py:
This is the output (both servers are running the latest asyncoro version):
Thanks! :)
Tuple (or any object) can't be sent over network; they have to be serialized and the remote side then have to deserialize (which means the definitions available at both sides with proper name). Following programs should work.
Testa.py:
and Testb.py:
Last edit: Giridhar Pemmasani 2016-10-12