tkimnguyen
(T. Kim Nguyen)
November 3, 2025, 8:04pm
1
Here's a launch.json I got working to debug a Plone Classic add-on that uses runwsgi (you will probably need to change the PYTHONPATH value that I used, in the last line):
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch runwsgi with debugpy",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/.venv/bin/runwsgi",
"args": [
"instance/etc/zope.ini"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": false,
"subProcess": true,
"preLaunchTask": "activate-venv",
"env": {
"PYTHONPATH": "${workspaceFolder}/.venv/lib/python3.10/site-packages"
}
}
]
}
It uses task.json to define the activate-venv task. You will no doubt need to change the path to activate.
{
"version": "2.0.0",
"tasks": [
{
"label": "activate-venv",
"type": "shell",
"command": "source .venv/bin/activate",
"options": {
"cwd": "${workspaceFolder}"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": false
}
}
]
}
davisagli
(David Glick)
November 3, 2025, 8:17pm
2
It shouldn’t be necessary to activate the virtualenv, since you’re giving the full path to the binary you’re running rather than expecting to find it in $PATH.
1 Like
fredvd
(Fred van Dijk)
November 3, 2025, 8:26pm
3
I would assume that the activated python interpreter/venv) is also used for the launch.
Asked AI to check, it suggests to use this in the launch.json for python and omit the PYTHON_PATH
// Use the interpreter VS Code already selected for this workspace:
"python": "${command:python.interpreterPath}",
You worked on your solution because something wasn’t working for you on your setup @tkimnguyen What were the shmptoms?
I’ve had too many struggles with VS Code already, so when I see something nee I’d like to understand what’s going on.
Edit: Python2.7 support maybe?
1 Like
tkimnguyen
(T. Kim Nguyen)
November 3, 2025, 8:35pm
4
Thanks! You were right.
At some point in this particular "journey" I thought it was needed because for a while Python wasn't finding Zope.
The task.json file is no longer needed either.
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch runwsgi with debugpy",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/.venv/bin/runwsgi",
"args": [
"instance/etc/zope.ini"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": false,
"subProcess": true,
"env": {
"PYTHONPATH": "${workspaceFolder}/.venv/lib/python3.10/site-packages"
}
}
]
}
tkimnguyen
(T. Kim Nguyen)
November 3, 2025, 8:42pm
5
fredvd:
I would assume that the activated python interpreter/venv) is also used for the launch.
Asked AI to check, it suggests to use this in the launch.json for python and omit the PYTHON_PATH
Aw, you guys are so nice
Yup! Again, I had explicitly specified PYTHON_PATH because of some trauma I suffered in this journey...
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch runwsgi with debugpy",
"type": "debugpy",
"request": "launch",
"python":"${command:python.interpreterPath}",
"program": "${workspaceFolder}/.venv/bin/runwsgi",
"args": [
"instance/etc/zope.ini"
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"justMyCode": false,
"subProcess": true,
}
]
}
tkimnguyen
(T. Kim Nguyen)
November 3, 2025, 8:46pm
6
fredvd:
You worked on your solution because something wasn’t working for you on your setup @tkimnguyen What were the shmptoms?
I’ve had too many struggles with VS Code already, so when I see something nee I’d like to understand what’s going on.
Edit: Python2.7 support maybe?
I just wanted a run configuration (PyCharm speak), and even with the supplied docs it was clear as mud. The chat thing helped, in a very, very roundabout way. It was like asking a drunk person to help me code... unlikely to work at all.
Nope, this is Plone 6.1.3 on Python 3.10.