Hello all,
I tried to run "packets.py" in cygwin shell using the command "python
packets.py" as instructed in the TOSSIM documentation.
As required, the RadioCountToLeds has been successfully built.
But im getting TypeError which says 'str' object is not callable.
The error in cygwin shell is shown below:
[EMAIL PROTECTED] /cygdrive/c/tinyos/cygwin/opt/tinyos-2.x/apps/radiocounttoleds
$ python packets.py
DEBUG (0): RadioCountToLedsC: timer fired, counter is 1.
DEBUG (0): RadioCountToLedsC: packet sent.
DEBUG (1): RadioCountToLedsC: timer fired, counter is 1.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (0): RadioCountToLedsC: timer fired, counter is 2.
DEBUG (0): RadioCountToLedsC: packet sent.
DEBUG (1): RadioCountToLedsC: timer fired, counter is 2.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (0): RadioCountToLedsC: timer fired, counter is 3.
DEBUG (0): RadioCountToLedsC: packet sent.
Traceback (most recent call last):
File "packets.py", line 47, in <module>
print "Delivering " + str(msg)+ " to 0 at " + str(t.time() + 3);
TypeError: 'str' object is not callable
*packets.py* code is as follows:
#! /usr/bin/python
import sys
from TOSSIM import *
from RadioCountMsg import *
t = Tossim([])
m = t.mac();
r = t.radio();
t.addChannel("RadioCountToLedsC", sys.stdout);
t.addChannel("LedsC", sys.stdout);
for i in range(0, 2):
m = t.getNode(i);
m.bootAtTime((31 + t.ticksPerSecond() / 10) * i + 1);
f = open("topo.txt", "r")
lines = f.readlines()
for line in lines:
s = line.split()
if (len(s) > 0):
if (s[0] == "gain"):
r.add(int(s[1]), int(s[2]), float(s[3]))
noise = open("meyer-heavy.txt", "r")
lines = noise.readlines()
for line in lines:
str = line.strip()
if (str != ""):
val = int(str)
for i in range(0, 4):
t.getNode(i).addNoiseTraceReading(val)
for i in range (0, 4):
t.getNode(i).createNoiseModel()
for i in range(0, 60):
t.runNextEvent();
msg = RadioCountMsg()
msg.set_counter(7);
pkt = t.newPacket();
pkt.setData(msg.data)
pkt.setType(msg.get_amType())
pkt.setDestination(0)
print "Delivering " + str(msg)+ " to 0 at " + str(t.time() + 3);
pkt.deliver(0, t.time() + 3)
for i in range(0, 20):
t.runNextEvent();
I have tried eliminating this bug using tostring() and other functions in
the code, still it endsup with the same error.
Could anyone please suggest me how to getrid of this error.
Best Regards,
Vijay.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help