Vendor debugpy for VS Code attach debugging
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>
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
"""Run this inside interactive Maya (Script Editor, Python tab) to enable
|
||||
the "Maya: Attach (debugpy)" launch config in .vscode/launch.json.
|
||||
|
||||
One-time setup -- install debugpy into Maya's own Python environment
|
||||
(adjust the path for your Maya version):
|
||||
|
||||
"C:\\Program Files\\Autodesk\\Maya2024\\bin\\mayapy.exe" -m pip install debugpy
|
||||
|
||||
Then, each Maya session, before attaching from VS Code:
|
||||
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())
|
||||
|
||||
@@ -15,6 +11,16 @@ 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"
|
||||
|
||||
Reference in New Issue
Block a user