Skip to content

Commit

Permalink
Only import debugpy if available locally #1582
Browse files Browse the repository at this point in the history
  • Loading branch information
Acly committed Feb 3, 2025
1 parent 2a47d3f commit 6bc0c0f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions ai_diffusion/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ def __init__(self, parent):
super().__init__(parent)
log.info(f"Extension initialized, Version: {__version__}, Python: {sys.version}")

try:
sys.path.append(str(Path(__file__).parent / "debugpy" / "src"))
import debugpy
debugpy_path = Path(__file__).parent / "debugpy" / "src"
if debugpy_path.exists():
try:
sys.path.insert(0, str(debugpy_path))
import debugpy

debugpy.listen(("127.0.0.1", 5678), in_process_debug_adapter=True)
log.info("Developer mode: debugpy listening on port 5678")
except ImportError:
pass
debugpy.listen(("127.0.0.1", 5678), in_process_debug_adapter=True)
log.info("Developer mode: debugpy listening on port 5678")
except ImportError:
pass

eventloop.setup()
settings.load()
Expand Down

0 comments on commit 6bc0c0f

Please sign in to comment.