When trying to use an actor, imp and initsig warnings appear in Python 3.5+.
Steps to Produce
- Create a new project and add code as follows
- Create an Actor
- Create actor with ActorSystem
- Run System
Code
import unittest
import logging
from thespian.actors import Actor, ActorSystem
from reactive.message.base_message import Message
class SourceMessage(Message):
pass
class TargetMessage(Message):
pass
class TestSource(Actor):
def receiveMessage(self, msg, sender):
if isinstance(msg, TargetMessage):
msg = "Received Message From {} via {}".format(msg, sender)
logging.info(msg)
elif isinstance(msg, SourceMessage):
if msg.sender is None:
msg.sender = self
self.send(msg.target, msg)
class TestTarget(Actor):
def receiveMessage(self, message, sender):
if isinstance(message, SourceMessage):
self.send(sender, 'Received a Message {}'.format(message.payload))
else:
logging.info("Received {}".format(message))
class TestActorSystem(unittest.TestCase):
def test_tell(self):
asys = ActorSystem("multiprocTCPBase")
source = asys.createActor(TestSource)
targ = asys.createActor(TestTarget)
msg = SourceMessage("Hello From Source", target=targ, sender=source)
logging.info("Sending {}".format(str(msg)))
asys.tell(source, msg)
asys.shutdown()
def test_ask(self):
pass
def test_round_robin_router(self):
pass
def test_balancing_router(self):
pass
if __name__ == "__main__":
unittest.main()
Expected Results
The actor system should be created and start. The actor should be created. The system should send a message and print the message to the screen.
Cheifly, no warnings are created
Actual Result
The actor system works but warns of deprecated packages
Warnings
.../usr/local/lib/python3.5/dist-packages/thespian/system/sourceLoader.py:66: PendingDeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
import imp
/usr/local/lib/python3.5/dist-packages/thespian/system/utilis.py:307: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
initsig = inspect.getargspec(klass.__init__).args
.
When trying to use an actor, imp and initsig warnings appear in Python 3.5+.
Steps to Produce
Code
Expected Results
The actor system should be created and start. The actor should be created. The system should send a message and print the message to the screen.
Cheifly, no warnings are created
Actual Result
The actor system works but warns of deprecated packages
Warnings