Add help msg for non `__main__` modules as well

sigintsaviour_citesthackin
Tyler Goodlet 2022-07-01 14:36:49 -04:00
parent 24b6cc0209
commit 65a9f69d6c
1 changed files with 13 additions and 6 deletions

View File

@ -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(<name>, 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(<name>, enable_modules=[{mod}])"
).format(
ns=ns,
mod=modpath,
)
mne.msg += msg
raise mne