Reputation: 41
I am trying out the python code specified in the UnetStack Handbook. While running tx.py and rx.py, UnetSocket object is created successfully as I print it out on the terminal, but the send() function sends Nonetype data at the receiver.
tx.py ===>>
from unetpy import UnetSocket
s = UnetSocket('localhost',1101)
print(s)
s.send('hellooo',31)
s.close()
rx.py =====>>>
from unetpy import UnetSocket
s = UnetSocket('localhost',1102)
rx = s.receive()
print('here ',rx)
print('from node : ',bytearray(rx.data).decode())
s.close()
First I run 2-node-network.groovy on the Simulator. Then rx.py and next tx.py from the terminal.
Error at rx.py Traceback (most recent call last): File "rx.py", line 6, in
print('from node : ',bytearray(rx.data).decode())
AttributeError: 'NoneType' object has no attribute 'data'
O/p at tx.py <unetpy.UnetSocket object at 0x7fe2909d4550>
Upvotes: 4
Views: 231
Reputation: 2280
I managed to reproduce your problem with the latest versions of unetpy + fjagepy. Seems to be a bug introduced in 1.7.1 release of fjagepy (I am assuming you have version 1.7.1 installed). Try:
pip install fjagepy==1.7.0
and then repeat your test to see if it works.
P.S. I have reported the problem to the maintainer for fjågepy and so hopefully we should have a fix in the next release. Until then you can use 1.7.0 release, if that works for you.
Upvotes: 6