ec5f52c7c6
Bundles debugpy 1.7.0 directly in python/ so "Maya: Attach (debugpy)" works with no per-machine pip install step. Installed via Maya 2022's own pip so it resolved a version actually compatible with Python 3.7 (Maya 2022's interpreter), then verified import + listen() succeeds under all three target Maya Python versions (3.7/3.9/3.10). Also fixes a latent __file__-under-exec() bug in start_debug_server.py (same pitfall as Maya's own plugin loader, never hit until this exercised it) and corrects the README's Maya Python version claim -- 2022 ships Python 3.7, not 3.9 as previously stated, which was never independently verified until now. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
"""Run this inside interactive Maya (Script Editor, Python tab) to enable
|
|
the "Maya: Attach (debugpy)" launch config in .vscode/launch.json.
|
|
|
|
debugpy is bundled in ../python/ -- no separate pip install needed. Each
|
|
Maya session, before attaching from VS Code, run:
|
|
|
|
exec(open(r"C:\\workspace\\PoseRenderer\\scripts\\start_debug_server.py").read())
|
|
|
|
Breakpoints hit in plug-ins/ or python/openpose_renderer/ (e.g. inside
|
|
draw_override.py's prepareForDraw, or a command's doIt) will then pause in
|
|
VS Code once you run "Maya: Attach (debugpy)".
|
|
"""
|
|
|
|
import sys
|
|
|
|
# Run via exec(open(path).read()) per the docstring above, so __file__ is
|
|
# not defined here (same pitfall as Maya's own .py plugin loader) -- the
|
|
# project's python/ dir is hardcoded to match where the exec() call above
|
|
# already points. Adjust this if your checkout lives somewhere else.
|
|
_PYTHON_DIR = r"C:\workspace\PoseRenderer\python"
|
|
if _PYTHON_DIR not in sys.path:
|
|
sys.path.insert(0, _PYTHON_DIR)
|
|
|
|
import debugpy
|
|
|
|
_ALREADY_LISTENING_ATTR = "_openpose_renderer_debugpy_listening"
|
|
|
|
if not getattr(debugpy, _ALREADY_LISTENING_ATTR, False):
|
|
debugpy.listen(("localhost", 5678))
|
|
setattr(debugpy, _ALREADY_LISTENING_ATTR, True)
|
|
print("[openpose_renderer] debugpy listening on localhost:5678 -- "
|
|
"run 'Maya: Attach (debugpy)' in VS Code to connect.")
|
|
else:
|
|
print("[openpose_renderer] debugpy already listening on localhost:5678.")
|