-
Notifications
You must be signed in to change notification settings - Fork 189
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Environment data
- VS Code version: 1.52.1
- OS and version: Ubuntu 20.04
- Python version: 3.8.5
- Type of virtual environment used: venv
- Relevant/affected Python packages and their versions: Flask, gevent
- Relevant/affected Python-related VS Code extensions and their versions: Python, v2020.12.424452561,
- Debugpy version: 1.2.1
Actual behavior
Running the app from the debug console doesn't stop in some breakpoints and a warning is printed.
Expected behavior
Stop in all breakpoints and resolve warnings
Steps to reproduce:
-
setup a virtualenv
- python3 -m ./.venv example
- source ./.venv/bin/activate
-
install packages
- python3 -m pip install flask gevent
-
create file
run.py
from gevent import monkey
monkey.patch_all()
from flask import Flask
from datetime import datetime
import re
app = Flask(__name__)
@app.route("/")
def home():
print('start')
print('set a breakpoint')
print('should stop')
return "Hello, Flask!"
@app.route("/hello/<name>")
def hello_there(name):
now = datetime.now()
formatted_now = now.strftime("%A, %d %B, %Y at %X")
# Filter the name argument to letters only using regular expressions. URL arguments
# can contain arbitrary text, so we restrict to safe characters only.
match_object = re.match("[a-zA-Z]+", name)
if match_object:
clean_name = match_object.group(0)
else:
clean_name = "Friend"
content = "Hello there, " + clean_name + "! It's " + formatted_now
return content
if __name__ == "__main__":
app.run(host='0.0.0.0', port=5100, debug=True, threaded=True, use_reloader=False)- configure files:
launch.json
{
"configurations": [
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"stopOnEntry": false,
"module": "flask",
"cwd": "${workspaceRoot}",
"env": {
"FLASK_APP": "run.py",
"FLASK_ENV": "development",
"FLASK_DEBUG": "0"
},
"args": [
"run",
"--no-debugger",
"--no-reload",
"--port=5100"
],
"jinja": true,
"console": "integratedTerminal",
"justMyCode": false
}
]
}settings.json
{
"python.pythonPath": "${env:HOME}/.venv/example/bin/python",
}Run from debug
Logs
- logs from console
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File "${HOME}/.venv/example/lib/python3.8/site-packages/gevent/threadpool.py", line 157, in _before_run_task
_sys.settrace(_get_thread_trace())
PYDEV DEBUGGER WARNING:
sys.settrace() should not be used when the debugger is being used.
This may cause the debugger to stop working correctly.
If this is needed, please check:
http://pydev.blogspot.com/2007/06/why-cant-pydev-debugger-work-with.html
to see how to restore the debug tracing back correctly.
Call Location:
File "${HOME}/.venv/example/lib/python3.8/site-packages/gevent/threadpool.py", line 162, in _after_run_task
_sys.settrace(None)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request