Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update imp to use importlib and resolve inspect deprecations #9

asevans48 opened this issue Oct 29, 2017 · 2 comments

Update imp to use importlib and resolve inspect deprecations #9

asevans48 opened this issue Oct 29, 2017 · 2 comments


Copy link

asevans48 commented Oct 29, 2017

When trying to use an actor, imp and initsig warnings appear in Python 3.5+.

Steps to Produce

  1. Create a new project and add code as follows
  2. Create an Actor
  3. Create actor with ActorSystem
  4. Run System


import unittest
import logging
from thespian.actors import Actor, ActorSystem
from reactive.message.base_message import Message

class SourceMessage(Message):

class TargetMessage(Message):

class TestSource(Actor):

    def receiveMessage(self, msg, sender):
        if isinstance(msg, TargetMessage):
            msg = "Received Message From {} via {}".format(msg, sender)
        elif isinstance(msg, SourceMessage):
            if msg.sender is None:
                msg.sender = self
            self.send(, msg)

class TestTarget(Actor):

    def receiveMessage(self, message, sender):
        if isinstance(message, SourceMessage):
            self.send(sender, 'Received a Message {}'.format(message.payload))
  "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)"Sending {}".format(str(msg)))
        asys.tell(source, msg)

    def test_ask(self):

    def test_round_robin_router(self):

    def test_balancing_router(self):

if __name__ == "__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


.../usr/local/lib/python3.5/dist-packages/thespian/system/ 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/ DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
  initsig = inspect.getargspec(klass.__init__).args
@asevans48 asevans48 changed the title Update imp to use importlib Update imp to use importlib and resolve inspect deprecations Oct 29, 2017
Copy link

kquick commented Dec 3, 2017

This is now resolved with recent commits. If you have a chance to verify the behavior in your environment I would appreciate it, @asevans48. This will be part of the next Thespian release.

Copy link

kquick commented Dec 22, 2017

Fixed in release 3.9.0 ( Thanks for the report and the assistance with the fix!

@kquick kquick closed this as completed Dec 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

No branches or pull requests

2 participants