Skip to content
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 warnings in debugger code #351

Closed
pkolbus opened this issue Jul 29, 2020 · 1 comment
Closed

Python warnings in debugger code #351

pkolbus opened this issue Jul 29, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@pkolbus
Copy link

pkolbus commented Jul 29, 2020

Environment data

  • VS Code version: 1.47.3
  • Extension version (available under the Extensions sidebar): 2020.7.96456
  • OS and version: Ubuntu 20.04
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): n/a
  • Relevant/affected Python packages and their versions: n/a
  • Relevant/affected Python-related VS Code extensions and their versions: n/a
  • Value of the python.languageServer setting: Pylance

Expected behaviour

No deprecation warnings.

Note: the Python 3.9 release notes encourage developers to check for DeprecationWarning, as many deprecated APIs are being removed in 3.9 and 3.10. See https://docs.python.org/3.9/whatsnew/3.9.html for details.

Actual behaviour

Terminal (Python Debug Console) contains a DeprecationWarning:

cd /home/kolbus/my-project ; env /usr/bin/python3.8 /home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/lib/python/debugpy/launcher 37295 -- /home/kolbus/.local/bin/pylint_runner 
/home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/lib/python/debugpy/../debugpy/common/compat.py:186: DeprecationWarning: inspect.getargspec() is deprecated since Python 3.0, use inspect.signature() or inspect.getfullargspec()
  arg_names, args_name, kwargs_name, arg_defaults = inspect.getargspec(f)

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Create a folder containing a simple Python file (even print("Hello World") is sufficient)
  2. From the Run view, click "create a launch.json file"
  3. Create a configuration and add PYTHONWARNINGS=default, i.e.:
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env": {"PYTHONWARNINGS": "default"}
        }
    ]
  1. Launch the debugger session.

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

> conda --version
> pyenv root
> python3.7 ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3.6 ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python3 ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python2 ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> conda info --json
> python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import jupyter"
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
> /usr/bin/python ~/.vscode/extensions/ms-python.python-2020.7.96456/pythonFiles/pyvsc-run-isolated.py -c "import notebook"
Error 2020-07-29 07:45:18: Failed to check if file needs to be fixed [EntryNotFound (FileSystemError): Unable to read file '/home/kolbus/projects/test-project/.vscode/settings.json' (EntryNotFound (FileSystemError): Error: ENOENT: no such file or directory, open '/home/kolbus/projects/test-project/.vscode/settings.json')
	at _handleError (/usr/share/code/resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:657:25)
	at processTicksAndRejections (internal/process/task_queues.js:85:5)
	at async v.readText (/home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/out/client/extension.js:1:571666)
	at async p.doesFileNeedToBeFixed (/home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/out/client/extension.js:48:932592)
	at async /home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/out/client/extension.js:48:931719
	at async Promise.all (index 1)
	at async p.getFilesToBeFixed (/home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/out/client/extension.js:48:931665)
	at async p.updateTestSettings (/home/kolbus/.vscode/extensions/ms-python.python-2020.7.96456/out/client/extension.js:48:931292)] {
  code: 'FileNotFound',
  name: 'EntryNotFound (FileSystemError)'
}
> pyenv root
> pyenv root
> pyenv root
Starting Pylance language server.
Python interpreter path: /usr/bin/python3.8
Error 2020-07-29 07:45:19: Attempted to download with skipDownload true.
> pyenv root
> conda --version
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root
> pyenv root

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Jul 29, 2020
@int19h int19h added the bug Something isn't working label Aug 13, 2020
@int19h int19h self-assigned this Aug 31, 2020
@int19h
Copy link
Contributor

int19h commented Sep 1, 2020

There are more warnings past this one, especially on shutdown, so I'm going to expand this item to cover the entirety of that cleanup.

@int19h int19h changed the title DeprecationWarning (inspect.getargspec) when debugging Python warnings in debugger code Sep 1, 2020
int19h added a commit to int19h/debugpy that referenced this issue Sep 1, 2020
Don't use inspect.getargspec on Python 2.

Close log file objects on exit.

Close the listener socket used to get endpoints info from adapter.

Run tests with Python warnings treated as errors.

Fix Django deprecation warning in test web app.

Work around pytest issues caused spaces in test names.
int19h added a commit to int19h/debugpy that referenced this issue Sep 2, 2020
Don't use inspect.getargspec on Python 2.

Close log file objects on exit.

Close os.devnull file objects on exit.

Close the listener socket used to get endpoints info from adapter.

Fix invalid escape sequences.

Run tests with Python warnings treated as errors.

Fix Django deprecation warning in test web app.

Work around pytest issues caused spaces in test names.
@int19h int19h closed this as completed in 14ca4f0 Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants