Revision history [back]
How to use python actor in BCVTB
Hi, I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. The python script that I have below gives me a TypeError. I can't seem to understand why '+' is not being recognised as an operand. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like:
class Main :
def fire(self) :
if not self.input.hasToken(0) :
return
t = self.input.get(0)
x = self.cons2.get(0)
y = int(t) + int(x)
self.output.broadcast(t)
But this gives me a TypeError.
How to use python actor in BCVTB
Hi,
I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. The python script that I have below gives me a TypeError. I can't seem to understand why '+' is not being recognised as an operand. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like:
like:
class Main :
def fire(self) :
:
if not self.input.hasToken(0) :
return
t = self.input.get(0)
x = self.cons2.get(0)
y = int(t) + int(x)
self.output.broadcast(t)
But this gives me a TypeError.
How to use python actor in BCVTB
Hi,
I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. The But it seems my python script that I have below gives me a TypeError. I can't seem to understand why '+' actor is not being recognised as an operand. able to output the addition result and give it to the plotter. I also updated the ports for python actor, wherin I take two variables. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like:
class Main :
def fire(self) :
if not self.input.hasToken(0) addition(x,y) :
return
t = self.input.get(0)
x = self.cons2.get(0)
y = int(t) + int(x)
self.output.broadcast(t)
But this gives me a TypeError. print x+y
C:\fakepath\plotter.PNG C:\fakepath\pythonactor.PNG C:\fakepath\pythonports.PNG C:\fakepath\systemxmlpage.PNG
How to use python actor in BCVTB
Hi,
I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. But it seems my python actor is not able to output the addition result and give it to the plotter. I also updated the ports for python actor, wherin I take two variables. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like:
class Main :
def addition(x,y) :
print x+y
C:\fakepath\plotter.PNG C:\fakepath\pythonactor.PNG C:\fakepath\pythonports.PNG C:\fakepath\systemxmlpage.PNG(/upfiles/14972645896070884.png)(/upfiles/14972645769414122.png)(/upfiles/14972645508520555.png)