You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.
I'm trying to integrate ptvsd with a flask app that has reloading feature enabled (as in it restarts when files are changed). This causes the ptvsd boilerplate code to be re-ran each time a reload happens, which results in a raised exception on repeat calls to ptvsd.enable_attach:
Environment data
PTVSD version: 4.2.3
OS and version: Windows 10 Pro 1703
Python version (& distribution if applicable, e.g. Anaconda): 3.6.8
Using VS Code or Visual Studio: VS Code
Actual behavior
raises exception on repeat calls to ptvsd.enable_attach:
OSError(10048, 'Only one usage of each socket address (protocol/network address/port) is normally permitted', None, 10048, None)
afterwards attaching to debugger works but does not work properly (breakpoints stop getting caught)
Use --multiprocess flag and --wait flags. --multiprocess flag enables subprocess tracking in ptvsd. You will need wait because, flask may start the child process before you can connect to the main process. VSC will not be able to connect to already started sub-process. Running the debugger with wait will block flask from running until you connect to the debugger. -m ptvsd --host localhost --port 5678 --multiprocess --wait -m flask run --host=localhost --no-debugger
Use this as attach configuration in VSC:
{"name": "Flask (remote)","type": "python","request": "attach","port": 5678,"host": "localhost","jinja": true,// for template debugging"subProcess": true,// for sub-process debugging"pathMappings": [{"localRoot": "${workspaceFolder}","remoteRoot": "."},]}
That will setup VSC to automatically attach to child process.
hey @karthiknadig thanks for all that, looking forward to the release 💯
You will need wait because, flask may start the child process before you can connect to the main process. VSC will not be able to connect to already started sub-process.
good to know in general
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I'm trying to integrate ptvsd with a flask app that has reloading feature enabled (as in it restarts when files are changed). This causes the ptvsd boilerplate code to be re-ran each time a reload happens, which results in a raised exception on repeat calls to
ptvsd.enable_attach
:Environment data
Actual behavior
raises exception on repeat calls to
ptvsd.enable_attach
:afterwards attaching to debugger works but does not work properly (breakpoints stop getting caught)
Expected behavior
handle reloading gracefully.
Steps to reproduce:
check out this repo which demos this issue
git clone https://github.com/bitstrider/ptvsd-flask-reload.git
pip install -r requirements.txt
./run.sh
The text was updated successfully, but these errors were encountered: