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

DebuggerInitializationError kills the kernel #986

Closed
krassowski opened this issue Sep 8, 2022 · 0 comments · Fixed by #987
Closed

DebuggerInitializationError kills the kernel #986

krassowski opened this issue Sep 8, 2022 · 0 comments · Fixed by #987

Comments

@krassowski
Copy link
Member

When debugger fails to intialise, the kernel dies because DebuggerInitializationError does not get handled on import. See jupyterlab/jupyterlab#13069 for an example on how innocent code.py file might prevent user from launching the kernel.

Example traceback:

Traceback (most recent call last):
  File "/3.9.5/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/3.9.5/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/ipykernel_launcher.py", line 15, in <module>
    from ipykernel import kernelapp as app
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/ipykernel/kernelapp.py", line 51, in <module>
    from .ipkernel import IPythonKernel
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/ipykernel/ipkernel.py", line 19, in <module>
    from .debugger import Debugger, _is_debugpy_available
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/ipykernel/debugger.py", line 22, in <module>
    from debugpy.server import api  # noqa
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/debugpy/server/__init__.py", line 7, in <module>
    import debugpy._vendored.force_pydevd  # noqa
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/debugpy/_vendored/force_pydevd.py", line 28, in <module>
    pydevd_constants = import_module('_pydevd_bundle.pydevd_constants')
  File "/3.9.5/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_constants.py", line 379, in <module>
    from _pydev_bundle._pydev_saved_modules import thread, threading
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_saved_modules.py", line 91, in <module>
    import code as _code;    verify_shadowed.check(_code, ['compile_command', 'InteractiveInterpreter'])
  File "/3.9.5/envs/ipython/lib/python3.9/site-packages/debugpy/_vendored/pydevd/_pydev_bundle/_pydev_saved_modules.py", line 75, in check
    raise DebuggerInitializationError(msg)
_pydev_bundle._pydev_saved_modules.DebuggerInitializationError: It was not possible to initialize the debugger due to a module name conflict.
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

Successfully merging a pull request may close this issue.

1 participant