mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 12:56:30 +01:00
Fix verbose import warning for debugpy contrib
This commit is contained in:
parent
abcb3d1cc3
commit
c3b01d0aec
1 changed files with 10 additions and 8 deletions
|
|
@ -1,17 +1,11 @@
|
|||
import sys
|
||||
|
||||
from django.conf import settings
|
||||
from evennia.utils import utils
|
||||
|
||||
COMMAND_DEFAULT_CLASS = utils.class_from_module(settings.COMMAND_DEFAULT_CLASS)
|
||||
|
||||
ERROR_MSG = """Error, debugpy not found! Please install debugpy by running: `pip install debugpy`
|
||||
After that please reboot Evennia with `evennia reboot`"""
|
||||
|
||||
try:
|
||||
import debugpy
|
||||
except ImportError:
|
||||
print(ERROR_MSG)
|
||||
sys.exit()
|
||||
ERROR_MSG = "debugpy needed for the debugpy contrib. Admin must install it and reboot."
|
||||
|
||||
|
||||
class CmdDebugPy(COMMAND_DEFAULT_CLASS):
|
||||
|
|
@ -20,12 +14,20 @@ class CmdDebugPy(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
Usage:
|
||||
debugpy
|
||||
|
||||
"""
|
||||
|
||||
key = "debugpy"
|
||||
locks = "cmd:perm(debugpy) or perm(Builder)"
|
||||
|
||||
def func(self):
|
||||
|
||||
try:
|
||||
import debugpy
|
||||
except ImportError:
|
||||
self.caller.msg(ERROR_MSG)
|
||||
return
|
||||
|
||||
caller = self.caller
|
||||
caller.msg("Waiting for debugger attach...")
|
||||
yield 0.1 # make sure msg is sent first
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue