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

Weird error message when opening neovim right after installing the plugin with lazy. #123

Closed
1nuno opened this issue Jun 14, 2024 · 2 comments · Fixed by #124
Closed

Weird error message when opening neovim right after installing the plugin with lazy. #123

1nuno opened this issue Jun 14, 2024 · 2 comments · Fixed by #124
Labels
bug Something isn't working

Comments

@1nuno
Copy link

1nuno commented Jun 14, 2024

Describe the bug
After updating the plugin today (14/06/2024), I reopened Neovim an saw a big error message that is shown in the additional context section of this issue description. To make sure it wasn't something in my config that was causing the error, I used the $NVIM_APPNAME environment variable to point Neovim to a new fresh basic config with just two plugins installed: lazy.nvim and jupynium.nvim. Still I got the same error message. Furthermore I tried opening a .ju.py file and ran this command JupyniumStartAndAttachToServer which indeed ran as expected but then when I ran JupyniumStartSync it opened a new notebook in the browser but it wasn't synced and it also showed a "kernel error" in the notebook gui itself.

To Reproduce
Steps to reproduce the behavior:

  1. Add necessary configuration to install jupynium.nvim with lazy.nvim
  2. Close Neovim
  3. Reopen Neovim
  4. See error

Expected behavior
Get no error when reopening Neovim after installing the jupynium.nvim plugin.

Logs in /tmp/jupynium/logs/

2024-06-14 16:37:36,534 - jupynium.pynvim_helpers:   15 - INFO - nvim addr: /run/user/1000/nvim.968716.0
2024-06-14 16:37:36,548 - jupynium.pynvim_helpers:   34 - INFO - nvim attached
2024-06-14 16:37:36,548 - jupynium.pynvim_helpers:   38 - INFO - Initialising..
2024-06-14 16:37:36,548 - jupynium.pynvim_helpers:   39 - INFO - Communicating with channel_id 13
2024-06-14 16:37:36,552 - jupynium.cmds.jupynium:  100 - INFO - Using firefox profile: None
2024-06-14 16:37:38,504 - jupynium.cmds.jupynium:  419 - INFO - Writing Jupyter Notebook server log to: /tmp/tmp574xkm0d
2024-06-14 16:37:59,948 - jupynium.events_control:  206 - INFO - Event from nvim: Request(type='request', name='start_sync', args=[1, '', True, [''], 'python', None], response=<pynvim.msgpack_rpc.async_session.Response object at 0x7fec7bd96710>)
2024-06-14 16:38:11,289 - jupynium.cmds.jupynium:  585 - ERROR - Uncaught exception occurred while processing events. Detaching nvim.
Traceback (most recent call last):
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/cmds/jupynium.py", line 580, in main
    status, rpcrequest_event = process_events(nvim_info, driver)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/events_control.py", line 216, in process_events
    status, request_event = process_request_event(nvim_info, driver, event)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/events_control.py", line 451, in process_request_event
    start_sync_with_filename(
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/events_control.py", line 331, in start_sync_with_filename
    sele.wait_until_notebook_loaded(driver)
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/selenium_helpers.py", line 25, in wait_until_notebook_loaded
    WebDriverWait(driver, timeout).until(
  File "/home/1nuno/.local/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 96, in until
    value = method(self._driver)
            ^^^^^^^^^^^^^^^^^^^^
  File "/home/1nuno/.local/lib/python3.11/site-packages/jupynium/selenium_helpers.py", line 27, in <lambda>
    lambda d: d.execute_script("return Jupyter.notebook.kernel == null")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/1nuno/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 407, in execute_script
    return self.execute(command, {"script": script, "args": converted_args})["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/1nuno/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 347, in execute
    self.error_handler.check_response(response)
  File "/home/1nuno/.local/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: Browsing context has been discarded
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:193:5
NoSuchWindowError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:679:5
assert.that/<@chrome://remote/content/shared/webdriver/Assert.sys.mjs:485:13
assert.open@chrome://remote/content/shared/webdriver/Assert.sys.mjs:147:4
GeckoDriver.prototype.execute_@chrome://remote/content/marionette/driver.sys.mjs:759:15
GeckoDriver.prototype.executeScript@chrome://remote/content/marionette/driver.sys.mjs:671:15
despatch@chrome://remote/content/marionette/server.sys.mjs:318:40
execute@chrome://remote/content/marionette/server.sys.mjs:289:16
onPacket/<@chrome://remote/content/marionette/server.sys.mjs:262:20
onPacket@chrome://remote/content/marionette/server.sys.mjs:263:9
_onJSONObjectReady/<@chrome://remote/content/marionette/transport.sys.mjs:494:20

2024-06-14 16:38:11,350 - jupynium.cmds.jupynium:  615 - INFO - Browser disconnected. Quitting Jupynium.
2024-06-14 16:38:11,353 - jupynium.cmds.jupynium:  161 - SUCCESS - Piecefully closed as the browser is closed.
2024-06-14 16:38:11,380 - jupynium.cmds.jupynium:  354 - INFO - Jupyter Notebook server (pid=969139) has been killed.

Output of jupynium --version

Jupynium v0.2.3

Output of nvim --version

NVIM v0.9.5
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=auto -fstack-protector-strong -DUNIT_TESTING -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DUSING_UV_SHARED=1 -I/usr/include/luajit-2.1 -I/usr/include -I/usr/include/luv -I/builddir/build/BUILD/neovim-0.9.5/redhat-linux-build/src/nvim/auto -I/builddir/build/BUILD/neovim-0.9.5/redhat-linux-build/include -I/builddir/build/BUILD/neovim-0.9.5/redhat-linux-build/cmake.config -I/builddir/build/BUILD/neovim-0.9.5/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Additional context

Failed to source `/home/1nuno/.local/share/nvim/lazy/jupynium.nvim/plugin/jupynium.vim`
vim/_editor.lua:0: /home/1nuno/dfiles/.config/nvim/init.lua..nvim_exec2() called at /home/1nuno/dfiles/.config/nvim/init.lua:0../home/1nuno/.local/
share/nvim/lazy/jupynium.nvim/plugin/jupynium.vim, line 9: Vim(lua):E5108: Error executing lua vim/shared.lua:0: s: expected string, got nil
stack traceback:
^I[C]: in function 'error'
^Ivim/shared.lua: in function 'validate'
^Ivim/shared.lua: in function 'startswith'
^I...cal/share/nvim/lazy/jupynium.nvim/lua/jupynium/cells.lua:11: in function 'line_type'
^I...cal/share/nvim/lazy/jupynium.nvim/lua/jupynium/cells.lua:72: in function 'is_line_separator'
^I...ocal/share/nvim/lazy/jupynium.nvim/lua/jupynium/init.lua:137: in function 'setup'
^I[string ":lua"]:1: in main chunk
^I...
^I[C]: in function 'xpcall'
^I.../.local/share/nvim/lazy/lazy.nvim/lua/lazy/core/util.lua:113: in function 'try'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:485: in function 'source'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:443: in function 'source_runtime'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:411: in function 'packadd'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:346: in function '_load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:191: in function 'load'
^I...local/share/nvim/lazy/lazy.nvim/lua/lazy/core/loader.lua:123: in function 'startup'
^I...1nuno/.local/share/nvim/lazy/lazy.nvim/lua/lazy/init.lua:112: in function 'setup'
^I/home/1nuno/dfiles/.config/nvim/init.lua:19: in main chunk

# stacktrace:
  - vim/_editor.lua:0 _in_ **cmd**
  - ~/dfiles/.config/nvim/init.lua:19
Failed to run `config` for jupynium.nvim

vim/shared.lua:0: s: expected string, got nil

# stacktrace:
  - vim/shared.lua:0 _in_ **validate**
  - vim/shared.lua:0 _in_ **startswith**
  - /jupynium.nvim/lua/jupynium/cells.lua:11 _in_ **line_type**
  - /jupynium.nvim/lua/jupynium/cells.lua:72 _in_ **is_line_separator**
  - /jupynium.nvim/lua/jupynium/cells.lua:11 _in_ **line_type**
  - /jupynium.nvim/lua/jupynium/cells.lua:72 _in_ **is_line_separator**
  - /jupynium.nvim/lua/jupynium/cells.lua:85 _in_ **current_cell_separator**
  - /jupynium.nvim/lua/jupynium/highlighter.lua:187 _in_ **update**
  - /jupynium.nvim/lua/jupynium/highlighter.lua:109 _in_ **enable**
  - /jupynium.nvim/lua/jupynium/highlighter.lua:54 _in_ **setup**
  - /jupynium.nvim/lua/jupynium/init.lua:137 _in_ **setup**
  - ~/.config/nvim/lua/plugins/jupyter.lua:6 _in_ **config**
  - ~/dfiles/.config/nvim/init.lua:19

EDIT: Forgot to mention my laptop specs

Laptop specs

OS: Fedora Linux 38 (Thirty Eight) x86_64
Host: 82JU Legion 5 15ACH6H
Kernel: 6.8.9-100.fc38.x86_64
Shell: bash 5.2.26
CPU: AMD Ryzen 5 5600H with Radeon Graphics (12) @ 4.280GHz
GPU: NVIDIA GeForce RTX 3060 Mobile / Max-Q
@kiyoon
Copy link
Owner

kiyoon commented Jun 15, 2024

Thanks for reporting. I hope this is fixed. I made a mistake not checking when the buffer is empty the line variable could be nil.

@1nuno
Copy link
Author

1nuno commented Jun 15, 2024

You work fast! Thank you, it's working flawlessly again!

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

Successfully merging a pull request may close this issue.

2 participants