-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python debugger not running when the start button is clicked on #1291
Comments
@SuryavaBhattacharya can you do a few things for us?
|
Also, please disable all extensions except for the |
@brettcannon
It alternates between these two errors. So, if I debug it once, it'll give the timeout error. Then clicking debug again runs the debugger and I can debug, but the error above is given. You could say it works but you have try it multiple times and it still gives the error above.... My settings code for python are as follows: // Automatically add brackets for functions.
"python.autoComplete.addBrackets": false,
// List of paths to libraries and the like that need to be imported by auto complete engine. E.g. when using Google App SDK, the paths are not in system path, hence need to be added into this list.
"python.autoComplete.extraPaths": [],
// Comma delimited list of modules preloaded to speed up Auto Complete (e.g. add Numpy, Pandas, etc, items slow to load when autocompleting).
"python.autoComplete.preloadModules": [],
// Controls appearance of methods with double underscores in the completion list.
"python.autoComplete.showAdvancedMembers": false,
// Whether to check if Python is installed (also warn when using the macOS-installed Python).
"python.disableInstallationCheck": false,
// Do not display a prompt to install these features
"python.disablePromptForFeatures": [],
// Absolute path to a file containing environment variable definitions.
"python.envFile": "${workspaceFolder}/.env",
// Arguments passed in. Each argument is a separate item in the array.
"python.formatting.autopep8Args": [],
// Path to autopep8, you can use a custom version of autopep8 by modifying this setting to include the full path.
"python.formatting.autopep8Path": "autopep8",
// Provider for formatting. Possible options include 'autopep8' and 'yapf'.
"python.formatting.provider": "autopep8",
// Arguments passed in. Each argument is a separate item in the array.
"python.formatting.yapfArgs": [],
// Path to yapf, you can use a custom version of yapf by modifying this setting to include the full path.
"python.formatting.yapfPath": "yapf",
// Whether to install Python modules globally when not using an environment.
"python.globalModuleInstallation": false,
// Memory limit for the Jedi completion engine in megabytes. Zero (default) means 1024 MB. -1 means unlimited (disable memory limit check)
"python.jediMemoryLimit": 0,
// Path to directory containing the Jedi library (this path will contain the 'Jedi' sub directory).
"python.jediPath": "",
// Whether to lint Python files.
"python.linting.enabled": true,
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.flake8Args": [],
// Severity of Flake8 message type 'E'.
"python.linting.flake8CategorySeverity.E": "Error",
// Severity of Flake8 message type 'F'.
"python.linting.flake8CategorySeverity.F": "Error",
// Severity of Flake8 message type 'W'.
"python.linting.flake8CategorySeverity.W": "Warning",
// Whether to lint Python files using flake8
"python.linting.flake8Enabled": false,
// Path to flake8, you can use a custom version of flake8 by modifying this setting to include the full path.
"python.linting.flake8Path": "flake8",
// Patterns used to exclude files or folders from being linted.
"python.linting.ignorePatterns": [
".vscode/*.py",
"**/site-packages/**/*.py"
],
// Whether to lint Python files when saved.
"python.linting.lintOnSave": true,
// Controls the maximum number of problems produced by the server.
"python.linting.maxNumberOfProblems": 100,
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.mypyArgs": [
"--ignore-missing-imports",
"--follow-imports=silent"
],
// Severity of Mypy message type 'Error'.
"python.linting.mypyCategorySeverity.error": "Error",
// Severity of Mypy message type 'Note'.
"python.linting.mypyCategorySeverity.note": "Information",
// Whether to lint Python files using mypy.
"python.linting.mypyEnabled": false,
// Path to mypy, you can use a custom version of mypy by modifying this setting to include the full path.
"python.linting.mypyPath": "mypy",
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.pep8Args": [],
// Severity of Pep8 message type 'E'.
"python.linting.pep8CategorySeverity.E": "Error",
// Severity of Pep8 message type 'W'.
"python.linting.pep8CategorySeverity.W": "Warning",
// Whether to lint Python files using pep8
"python.linting.pep8Enabled": false,
// Path to pep8, you can use a custom version of pep8 by modifying this setting to include the full path.
"python.linting.pep8Path": "pep8",
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.prospectorArgs": [],
// Whether to lint Python files using prospector.
"python.linting.prospectorEnabled": false,
// Path to Prospector, you can use a custom version of prospector by modifying this setting to include the full path.
"python.linting.prospectorPath": "prospector",
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.pydocstyleArgs": [],
// Whether to lint Python files using pydocstyle
"python.linting.pydocstyleEnabled": false,
// Path to pydocstyle, you can use a custom version of pydocstyle by modifying this setting to include the full path.
"python.linting.pydocstylePath": "pydocstyle",
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.pylamaArgs": [],
// Whether to lint Python files using pylama.
"python.linting.pylamaEnabled": false,
// Path to pylama, you can use a custom version of pylama by modifying this setting to include the full path.
"python.linting.pylamaPath": "pylama",
// Arguments passed in. Each argument is a separate item in the array.
"python.linting.pylintArgs": [],
// Severity of Pylint message type 'Convention/C'.
"python.linting.pylintCategorySeverity.convention": "Information",
// Severity of Pylint message type 'Error/E'.
"python.linting.pylintCategorySeverity.error": "Error",
// Severity of Pylint message type 'Fatal/F'.
"python.linting.pylintCategorySeverity.fatal": "Error",
// Severity of Pylint message type 'Refactor/R'.
"python.linting.pylintCategorySeverity.refactor": "Hint",
// Severity of Pylint message type 'Warning/W'.
"python.linting.pylintCategorySeverity.warning": "Warning",
// Whether to lint Python files using pylint.
"python.linting.pylintEnabled": true,
// Path to Pylint, you can use a custom version of pylint by modifying this setting to include the full path.
"python.linting.pylintPath": "pylint",
// Whether to run Pylint with minimal set of rules.
"python.linting.pylintUseMinimalCheckers": true,
// Path to Python, you can use a custom version of Python by modifying this setting to include the full path.
"python.pythonPath": "python",
// Arguments passed in. Each argument is a separate item in the array.
"python.sortImports.args": [],
// Path to isort script, default using inner version
"python.sortImports.path": "",
// Activate Python Environment in Terminal created using the Extension.
"python.terminal.activateEnvironment": true,
// When executing a file in the terminal, whether to use execute in the file's directory, instead of the current open folder.
"python.terminal.executeInFileDir": false,
// Python launch arguments to use when executing a file in the terminal.
"python.terminal.launchArgs": [],
// Optional working directory for unit tests.
"python.unitTest.cwd": null,
// IP Address of the of the local unit test server (default is localhost or use 127.0.0.1).
"python.unitTest.debugHost": "localhost",
// Port number used for debugging of unittests.
"python.unitTest.debugPort": 3000,
// Arguments passed in. Each argument is a separate item in the array.
"python.unitTest.nosetestArgs": [],
// Path to nosetests, you can use a custom version of nosetests by modifying this setting to include the full path.
"python.unitTest.nosetestPath": "nosetests",
// Whether to enable or disable unit testing using nosetests.
"python.unitTest.nosetestsEnabled": false,
// Where to prompt to configure a test framework if potential tests directories are discovered.
"python.unitTest.promptToConfigure": true,
// Arguments passed in. Each argument is a separate item in the array.
"python.unitTest.pyTestArgs": [],
// Whether to enable or disable unit testing using pytest.
"python.unitTest.pyTestEnabled": false,
// Path to pytest (pytest), you can use a custom version of pytest by modifying this setting to include the full path.
"python.unitTest.pyTestPath": "pytest",
// Arguments passed in. Each argument is a separate item in the array.
"python.unitTest.unittestArgs": [
"-v",
"-s",
".",
"-p",
"*test*.py"
],
// Whether to enable or disable unit testing using unittest.
"python.unitTest.unittestEnabled": false,
// Use the experimental debugger when debugging unit tests.
"python.unitTest.useExperimentalDebugger": false,
// Folders in your home directory to look into for virtual environments.
"python.venvFolders": [
"envs",
".pyenv",
".direnv"
],
// Path to folder with a list of Virtual Environments (e.g. ~/.pyenv, ~/Envs, ~/.virtualenvs).
"python.venvPath": "",
// Fully qualilified path to the ctags executable (else leave as ctags, assuming it is in current path).
"python.workspaceSymbols.ctagsPath": "ctags",
// Set to 'false' to disable Workspace Symbol provider using ctags.
"python.workspaceSymbols.enabled": true,
// Pattern used to exclude files and folders from ctags See http://ctags.sourceforge.net/ctags.html.
"python.workspaceSymbols.exclusionPatterns": [
"**/site-packages/**"
],
// Whether to re-build the tags file on when changes made to python files are saved.
"python.workspaceSymbols.rebuildOnFileSave": true,
// Whether to re-build the tags file on start (defaults to true).
"python.workspaceSymbols.rebuildOnStart": true,
// Fully qualified path to tag file (exuberant ctag file), used to provide workspace symbols.
"python.workspaceSymbols.tagFilePath": "${workspaceFolder}/.vscode/tags"
}
,
{
// Default settings per language.
"jupyter.languages": [
{
"languageId": "python",
"startupCode": [
"%matplotlib inline"
],
"cellIdentificationPattern": "^(#\\s*%%|#\\s*\\<codecell\\>|#\\s*In\\[\\d*?\\]|#\\s*In\\[ \\])(.*)"
},
{
"languageId": "javascript",
"cellIdentificationPattern": "^(\\/\\/ %%|\\/\\/%%|\\/\\/ \\<codecell\\>|\\/\\/ In\\[\\d*?\\]|\\/\\/ In\\[ \\])(.*)"
}
],
// Whether to append the results to results window, else clear and display.
"jupyter.appendResults": true,
// 'jupyter notebook' command line arguments. Each argument is a separate item in the array. For a full list type 'jupyter notebook --help' in a terminal window.
"jupyter.notebook.startupArgs": [
"--no-browser",
"--port=8888",
"--NotebookApp.allow_origin=\"*\""
] My launch.json is: {
// 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": "Watson",
"type": "pythonExperimental",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
],
"jinja": true
},
{
"name": "Python Experimental: Terminal (integrated)",
"type": "pythonExperimental",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python Experimental: Terminal (external)",
"type": "pythonExperimental",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Scrapy",
"type": "pythonExperimental",
"request": "launch",
"module": "scrapy",
"args": [
"crawl",
"specs",
"-o",
"bikes.json"
]
},
{
"name": "PySpark",
"type": "pythonExperimental",
"request": "launch",
"osx": {
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
},
"windows": {
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit.cmd"
},
"linux": {
"pythonPath": "${env:SPARK_HOME}/bin/spark-submit"
},
"program": "${file}"
},
{
"name": "Pyramid",
"type": "pythonExperimental",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"pyramid": true,
"jinja": true
},
{
"name": "Flask",
"type": "pythonExperimental",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Django",
"type": "pythonExperimental",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Attach (Remote Debug)",
"type": "pythonExperimental",
"request": "attach",
"port": 3000,
"host": "localhost"
},
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "module.name"
},
{
"name": "Python: Pyramid",
"type": "python",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"debugOptions": [
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Python: Watson",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
]
},
{
"name": "Python: All debug Options",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"module": "module.name",
"env": {
"VAR1": "1",
"VAR2": "2"
},
"envFile": "${workspaceFolder}/.env",
"args": [
"arg1",
"arg2"
],
"debugOptions": [
"RedirectOutput"
]
}
]
} Thanks |
@DonJayamanne Disabling all the other extensions, except the Python extension, had no additional effect. |
met the same problem when debugging time-consuming functions with django |
Please could you provide some sample code that we could use to replicate this issue. |
I'm running into the same after a few successful tries, in some case it also was working again after reboot... but now I can't even make it work after reboot... I wonder if this is somewhat related to https://stackoverflow.com/questions/13597812/pydev-cant-debug-anymore? |
Hum.. I deleted So perhaps we are not cleaning something? I'm unsure what to be honest but perhaps this offers some hint @DonJayamanne ? EDIT: I also deleted the |
@mike-pt |
No I can't and I doubt that's possible. I believe this is only triggered when debugging complex scripts (with imports to other files and args etc) With a simple print this seems to work fine. I feels like if we have to stop / restart the debugger for some reason we hit this issue. I investigated further and wipped just the keys that were related to debug and python in LocalStorage restarted and this makes it work again... I also tested by turning of the automatic breakpoints (on exceptions) let it run until the end.... Then again... And again and I couldn't repro... Using stopped doesn't always cause it though which is intriguing... Might also have to do with where I'm stopping ... But yeah it seems only complex scripts trigger it... |
For me, this problem occurs regardless of the complexity of the script. It still as I described in my precious post. The debugger doesn't run or is volatile when running. It does unexpected things and doesn't stop at breakpoints if it does run |
@SuryavaBhattacharya Please could you change your terminal from Once changed, please restart VS Code and test once again. |
@DonJayamanne I tried this to no avail.... |
|
@DonJayamanne It seems that after I restarted my computer, your solution worked! |
Environment data
Actual behavior
I start the Debug, but it keeps loading and does not actually start the debug process:
The blue bar keeps moving left to right but the debug process doesn't start.
I have checked whether it's an issue with the Debugger by Debugging a .c file, but that works just fine, so it must be a problem with Python.
In the integrated terminal, within cd command, this comes up:
Expected behavior
The Debug starts and then runs
Steps to reproduce:
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)Output from
Console
under theDeveloper Tools
panel (toggle Developer Tools on underHelp
)The text was updated successfully, but these errors were encountered: