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

Exception: 'NoneType' object has no attribute 'additional_info' #492

Closed
KathRains opened this issue Dec 7, 2020 · 9 comments
Closed

Exception: 'NoneType' object has no attribute 'additional_info' #492

KathRains opened this issue Dec 7, 2020 · 9 comments

Comments

@KathRains
Copy link

Environment data

  • VS Code version: 1.51,1
  • Extension version (available under the Extensions sidebar): v2020.11.371526539
  • OS and version: Win 7
  • Python version (& distribution if applicable, e.g. Anaconda): 3.6.8
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv
  • Relevant/affected Python packages and their versions: -
  • Relevant/affected Python-related VS Code extensions and their versions: -
  • Value of the python.languageServer setting: -

Expected behaviour

Works normally

Actual behaviour

Hit the exception: NoneType' object has no attribute 'additional_info'

.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 125

Steps to reproduce:

Not sure how to repro it. It suddenly stopped working. What I did - I added the line into the code that should throw an exception, and created handlers that would catch it but they don't. Instead, if I debug the code, I have that exception.

Logs

User belongs to experiment group 'ShowPlayIcon - start' User belongs to experiment group 'ShowExtensionSurveyPrompt - enabled' User belongs to experiment group 'DebugAdapterFactory - experiment' User belongs to experiment group 'PtvsdWheels37 - experiment' User belongs to experiment group 'UseTerminalToGetActivatedEnvVars - control' User belongs to experiment group 'LocalZMQKernel - experiment' User belongs to experiment group 'CollectLSRequestTiming - control' User belongs to experiment group 'CollectNodeLSRequestTiming - experiment' User belongs to experiment group 'EnableIPyWidgets - experiment' User belongs to experiment group 'RunByLine - experiment' User belongs to experiment group 'CustomEditorSupport - control' User belongs to experiment group 'pythonaa' User belongs to experiment group 'pythonInstallPylintButtonFirstcf' Error 2020-12-07 15:30:24: Failed to create File hash for interpreter D:\Python332\python.exe [Error: ENOENT: no such file or directory, lstat 'D:\Python332\python.exe'] { errno: -4058, code: 'ENOENT', syscall: 'lstat', path: 'D:\\Python332\\python.exe' } > pyenv root > conda --version > python3.7 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python3.6 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python3 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3.6 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -3.7 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > py -2 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" > python2 c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)" Python interpreter path: .\venv\Scripts\python.exe Starting Jedi Python language engine. > C:\Development\Anaconda3\Scripts\conda.exe info --json > C:\Development\Anaconda3\Scripts\conda.exe env list Error 2020-12-07 15:30:29: Failed to get interpreter information for 'D:\Python332\python.exe' [Error: Command failed: "D:\\Python332\python.exe" "c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py" "c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\interpreterInfo.py" The system cannot find the path specified.
at ChildProcess.exithandler (child_process.js:304:12)
at ChildProcess.emit (events.js:223:5)
at maybeClose (internal/child_process.js:1021:16)
at Socket.<anonymous> (internal/child_process.js:430:11)
at Socket.emit (events.js:223:5)
at Pipe.<anonymous> (net.js:664:12)] {

killed: false,
code: 1,
signal: null,
cmd: '"D:\\Python332\python.exe" "c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py" "c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\interpreterInfo.py"'
}

C:\Development\Anaconda3\Scripts\conda.exe info --json
pyenv root
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\testing_tools\run_adapter.py discover pytest -- --rootdir d:\Projects\Work\test\test-backend -s --cache-clear tests
cwd: d:\Projects\Work\test\test-backend
C:\Development\Anaconda3\Scripts\conda.exe env list
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.prefix)"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "import sys;print(sys.executable)"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py site --user-site
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py site --user-site
cwd: d:\Projects\Work\test\test-backend
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\completion.py
d:\Projects\Work\test\test-backend\venv\Scripts\python.exe c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\pyvsc-run-isolated.py c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\completion.py

Traceback (most recent call last): File "c:\Users\user\.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 115, in set_additional_thread_info additional_info = thread.additional_info AttributeError: 'NoneType' object has no attribute 'additional_info'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_frame.py", line 1022, in trace_dispatch
self.do_wait_suspend(thread, frame, event, arg)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_frame.py", line 153, in do_wait_suspend
self._args[0].do_wait_suspend(*args, **kwargs)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd\pydevd.py", line 1854, in do_wait_suspend
with self._threads_suspended_single_notification.notify_thread_suspended(thread_id, stop_reason):
File "C:\Development\Python36\lib\contextlib.py", line 81, in enter
return next(self.gen)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd\pydevd.py", line 422, in notify_thread_suspended
with AbstractSingleNotificationBehavior.notify_thread_suspended(self, thread_id, stop_reason):
File "C:\Development\Python36\lib\contextlib.py", line 81, in enter
return next(self.gen)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd\pydevd.py", line 376, in notify_thread_suspended
self.on_thread_suspend(thread_id, stop_reason)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd\pydevd.py", line 347, in on_thread_suspend
self.send_suspend_notification(thread_id, stop_reason)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd\pydevd.py", line 416, in send_suspend_notification
py_db.writer.add_command(py_db.cmd_factory.make_thread_suspend_single_notification(py_db, thread_id, stop_reason))
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_net_command_factory_json.py", line 315, in make_thread_suspend_single_notification
info = set_additional_thread_info(thread)
File "c:\Users\user.vscode\extensions\ms-python.python-2020.11.371526539\pythonFiles\lib\python\debugpy_vendored\pydevd_pydevd_bundle\pydevd_additional_thread_info_regular.py", line 125, in set_additional_thread_info
thread.additional_info = additional_info
AttributeError: 'NoneType' object has no attribute 'additional_info'

XXX

@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Dec 8, 2020
@int19h int19h changed the title Python extension exception Exception: 'NoneType' object has no attribute 'additional_info' Dec 8, 2020
@KathRains
Copy link
Author

I also found that Python interpreter is probably set up wrong and can't fix it. Please see the screenshot below.

image

If I set up "justMyCode": false in launch.json, I immediately hit some exceptions in Python installed somewhere else (no in env).

My settings:

{

    "python.testing.unittestEnabled": false,
    "python.testing.nosetestsEnabled": false,
    "python.testing.pytestEnabled": true,
    "python.testing.pytestArgs": [
        "tests"
    ],
    "python.pythonPath": "venv\\Scripts\\python.exe"
}

But when I click the select interpreter it pretends it doesn't recognize it:

image

@fabioz
Copy link
Collaborator

fabioz commented Dec 10, 2020

Have you tried putting the full path in python.pythonPath to see if it helps?

As for the 'NoneType' object has no attribute 'additional_info', can you provide the logs when this happens?

i.e.:

  • Open VS Code
  • Select the command Extensions: Open Extensions Folder
  • Locate the Python extension directory, typically of the form ms-python.python-2020..***
  • In that directory ensure you do not have any debug*.log files, if you do, please delete them
  • Go back into VS Code and modify your launch.json to add the setting "logToFile": true, see below:
{
    "name": "Python: Current File (Integrated Terminal)",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "logToFile": true
}
  • Start debugging
  • When done, go back into the extension directory and upload the debug*.log files into this GitHub issue.

@KathRains
Copy link
Author

@fabioz Thanks for your response. Yes, I tried. The same result.
But what I found is I have this exception only when I have FLASK_DEBUG = 0 in my launch.json. As soon as I set it up to 1, no exceptions anymore. I will try to provide logs.

@fabioz
Copy link
Collaborator

fabioz commented Dec 17, 2020

As a note, I'm waiting for the logs... or at least the full stack trace (as it is, I just know that None was passed as the thread when trying to get the debugger info from the thread, but there are many places that call into it, so, it's hard to track down without the full stack trace -- which the logs should show).

So, given that this report is currently not actionable and further info wasn't provided, I'm going to close the request.

@KathRains Please reopen when/if you're able to provide the logs.

@fabioz fabioz closed this as completed Dec 17, 2020
@KathRains
Copy link
Author

KathRains commented Dec 18, 2020

Hi, sorry for the delay, here are logs, in zip file. Please remove them out from the git after you download them if possible because they may have some sensitive information (even although I checked and cleaned files). Thanks. I don't know how to reopen the issue though (I think it's not possible for me because I didn't close it).

@fabioz fabioz reopened this Dec 18, 2020
@fabioz
Copy link
Collaborator

fabioz commented Dec 18, 2020

Thanks for the info. I've just reopened the issue.

@fabioz
Copy link
Collaborator

fabioz commented Dec 18, 2020

Can you do one check for me?

In the file:

c:\Users\user\.vscode\extensions\ms-python.python-2020.12.424452561\pythonFiles\lib\python\debugpy\_vendored\pydevd\_pydev_bundle\pydev_monkey.py

In line 919 (inside the if thread_id is not None:)

if you add

py_db.disable_tracing() -- right before py_db.notify_thread_not_alive(thread_id)

Does it stop giving that error?

@KathRains
Copy link
Author

Let me try

@KathRains
Copy link
Author

Okay, it looks like the exception has gone after I added that line. At least, I don't see any information in the terminal.

fabioz added a commit to fabioz/debugpy that referenced this issue Dec 19, 2020
fabioz added a commit to fabioz/debugpy that referenced this issue Dec 19, 2020
fabioz added a commit to fabioz/debugpy that referenced this issue Dec 31, 2020
@fabioz fabioz closed this as completed in 59ee2ed Jan 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants