forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team
Description
Does this issue occur when all extensions are disabled?: N/A
- VS Code Version: 1.94.2
- OS Version: Windows 11 23H2
Steps to Reproduce:
- Follow the instructions to setup FastAPI application: https://code.visualstudio.com/docs/python/tutorial-fastapi
- Launch the debugging session using F5 for the python file
- If Port 8000 is already used by another program, it throws following error
ERROR: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
There is no instruction in this page as to how to resolve this issue. The solution is to create a custom "launch.json" under .vscode folder that allows overriding port for uvicorn module. This resolves the issue while launching python file using F5.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: FastAPI",
"type": "debugpy",
"request": "launch",
"module": "uvicorn",
"args": [
"groceries-plugin.main:app",
"--port", // This option is for overriding port
"20000", // Custom port number to avoid [WinError 10013] error
"--reload"
],
"jinja": true
}
]
}Metadata
Metadata
Assignees
Labels
triage-neededNeeds assignment to the proper sub-teamNeeds assignment to the proper sub-team