Hello I am new to the SPADE platform. When I try to run the example below of the documentation. I get the error below--Exception in thread ag...@127.0.0.1:Traceback (most recent call last):File "C:\Python27\lib\threading.py", line 530, in __bootstrap_innerself.run()File "C:\Python27\lib\spade\Agent.py", line 1001, in runself._setup()File "D:/DropboxSalimaJan2016/Dropbox/Mes travaux de Recherche/Implementation/Examples python2.7 et SPADE/MyAgentSendReceiveMsg.py", line 45, in _setupself.addBehaviour(ab, mt)NameError: global name 'ab' is not definedThe variable ab is missing.import spade class MyAgent(spade.Agent.Agent): class ReceiveBehav(spade.Behaviour.Behaviour): """This behaviour will receive all kind of messages""" def _process(self): self.msg = None # Blocking receive for 10 seconds self.msg = self._receive(True, 10) # Check wether the message arrived if self.msg: print "I got a message!" else: print "I waited but got no message" class AnotherBehav(spade.Behaviour.Behaviour): """This behaviour will receive only messages of the 'cooking' ontology"""def _process(self): self.msg = None # Blocking receive indefinitely self.msg = self._receive(True) # Check wether the message arrived if self.msg: print "I got a cooking message!" else: print "I waited but got no cooking message" def _setup(self): # Add the "ReceiveBehav" as the default behaviour rb = self.ReceiveBehav() self.setDefaultBehaviour(rb) # Prepare template for "AnotherBehav" cooking_template = spade.Behaviour.ACLTemplate() cooking_template.setOntology("cooking") mt = spade.Behaviour.MessageTemplate(cooking_template) # Add the behaviour WITH the template self.addBehaviour(ab, mt) if __name__ == "__main__": a = MyAgent("ag...@127.0.0.1", "secret") a.start()
You received this message because you are subscribed to the Google Groups "spade-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spade-users+unsubscribe@googlegroups.com.
To post to this group, send email to spade...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
M.Best,Hope this helps!ab = self.AnotherBehav()Hello!Yes, the example is missing an additional instance of behaviour, e.g. something like:
--
Markus Schatten, PhD
Assistant professor and head of Artificial Intelligence Lab
University of Zagreb
Faculty of Organization and Informatics
Pavlinska 2, 42000 Varazdin, Croatia
http://www.foi.hr/nastavnici/schatten.markus/index.html
http://www.researchgate.net/profile/Markus_Schatten1
http://ai.foi.hr
On Thu, Dec 1, 2016 at 8:04 AM, salima <mnifs...@gmail.com> wrote:
Hello I am new to the SPADE platform. When I try to run the example below of the documentation. I get the error below
Exception in thread ag...@127.0.0.1:Traceback (most recent call last):File "C:\Python27\lib\threading.py", line 530, in __bootstrap_innerself.run()File "C:\Python27\lib\spade\Agent.py", line 1001, in runself._setup()
To unsubscribe from this group and stop receiving emails from it, send an email to spade-users...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to spade-users+unsubscribe@googlegroups.com.