spade icon indicating copy to clipboard operation
spade copied to clipboard

Spade support for Python 3.8.1

Open siboxd opened this issue 6 years ago • 5 comments

  • SPADE version: 3.1.4
  • Python version: 3.8.1
  • Operating System: Windows 10, 64bit

Description

I'm a beginner with Spade and I was trying to follow the Quick start guide. In particular I was trying to make my first dummyagent.py work (where password is a .py file with variable my containing my correct password):

from spade import agent
import password

class DummyAgent(agent.Agent):
    async def setup(self):
        print("Hello World! I'm agent {}".format(str(self.jid)))

dummy = DummyAgent("[email protected]", password.my)
dummy.start()

dummy.stop()

So I installed the latest version of Python 3.8.1, created a virtual environment and installed Spade 3.4.1 through pipenv.

Then when I launched python dummyagent.py nothing happened. It seems that the process freezes and the agent won't start (no "Hello World" expected message will be printed.)

Launching that dummyagent.py should print the above mentioned message.

What I Did

I created a folder test in which i put the dummyagent.py and the password.py.

Cattura1

Cattura2

The last command will never write Hello World ...

siboxd avatar Feb 24 '20 14:02 siboxd

I tried the same with Python 3.7.6, and it works.

Cattura

siboxd avatar Feb 24 '20 14:02 siboxd

Hi I've never tested SPADE with python >=3.8. I'll try to test it and fix code ASAP.

javipalanca avatar Feb 24 '20 20:02 javipalanca

However, having a start and a stop in a row may be too fast. Try introducing a sleep between them, or the common:

dummy.start()
while True:
    try:
        time.sleep(1)
    except KeyboardInterrupt:
        break
dummy.stop()

javipalanca avatar Feb 24 '20 20:02 javipalanca

However, having a start and a stop in a row may be too fast. Try introducing a sleep between them, or the common:

dummy.start()
while True:
    try:
        time.sleep(1)
    except KeyboardInterrupt:
        break
dummy.stop()

Before opening this issue I also tried the second example present in "Quick Start Guide".

It seems to adopt the above mentioned pattern, but the example code still doesn't work with python 3.8.1, while (I've tried and) it works with python 3.7.6.

Cattura1

Cattura2

It won't go ahead from here.

siboxd avatar Feb 25 '20 14:02 siboxd

hello guys, How can I broadcast messages using spade in a multi-agent system? can you please give me some sample code in python (SPADE)?

bdpythondocker avatar Jun 07 '21 01:06 bdpythondocker