From 65a9f69d6c725e5653ac9cb4f90446beee4773e7 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 1 Jul 2022 14:36:49 -0400 Subject: [PATCH] Add help msg for non `__main__` modules as well --- tractor/_actor.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/tractor/_actor.py b/tractor/_actor.py index 9b9bf5d..78ffa0a 100644 --- a/tractor/_actor.py +++ b/tractor/_actor.py @@ -509,13 +509,20 @@ class Actor: mne = ModuleNotExposed(*err.args) if ns == '__main__': - msg = ( - "\n\nMake sure you exposed the current module using:\n\n" - "ActorNursery.start_actor(, enable_modules=" - "[__name__])" - ) + modpath = '__name__' + else: + modpath = f"'{ns}'" - mne.msg += msg + msg = ( + "\n\nMake sure you exposed the target module, `{ns}`, " + "using:\n" + "ActorNursery.start_actor(, enable_modules=[{mod}])" + ).format( + ns=ns, + mod=modpath, + ) + + mne.msg += msg raise mne