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

Syncing to existing, running ipynb on remote server #128

Open
aaronmlevy opened this issue Jul 16, 2024 · 3 comments
Open

Syncing to existing, running ipynb on remote server #128

aaronmlevy opened this issue Jul 16, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@aaronmlevy
Copy link

Describe the bug

When I host a Jupyter server + Neovim on a remote server and then connect with port forwarding on Firefox to my client machine, I cannot sync to existing, running ipynb files. This is important if, for example, my Neovim instance quits in the middle of a kernel session and I want to re-attach to the running ipynb file with a new Neovim instance.

If I try to do by opening the ipynb file and running :JupyniumStartSync 1, I get the following logs

jupynium.cmds.jupynium:  585 - ERROR - Uncaught exception occurred while processing events. Detaching nvim.
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/jupynium/cmds/jupynium.py", line 580, in main
    status, rpcrequest_event = process_events(nvim_info, driver)
  File "/usr/local/lib/python3.9/site-packages/jupynium/events_control.py", line 220, in process_events
    status, request_event = process_request_event(nvim_info, driver, event)
  File "/usr/local/lib/python3.9/site-packages/jupynium/events_control.py", line 494, in process_request_event
    nvim_info.jupbufs[bufnr].full_sync_to_notebook(driver)
  File "/usr/local/lib/python3.9/site-packages/jupynium/buffer.py", line 448, in full_sync_to_notebook
    num_cells_in_notebook = driver.execute_script(
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 414, in execute_script
    return self.execute(command, {"script": script, "args": converted_args})["value"]
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File "/usr/local/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.JavascriptException: Message: TypeError: Jupyter.notebook is undefined
Stacktrace:
@http://localhost:8888/nbclassic/tree:2:7
@http://localhost:8888/nbclassic/tree:3:8

To Reproduce

  1. Run a Jupyter kernel + Neovim on a remote machine
  2. Connect with ssh port forwarding
  3. Create an ipynb file and add some content
  4. Close Neovim on the remote machine
  5. Open the same running ipynb kernel
  6. Reopen Neovim and run :JupyniumStartSync 1

Expected behavior

The Neovim content should replace the content in the ipynb file.

Logs in /tmp/jupynium/logs/

See above

Output of jupynium --version

Jupynium v0.2.4

Output of nvim --version

NVIM v0.10.0-dev
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
@aaronmlevy aaronmlevy added the bug Something isn't working label Jul 16, 2024
@kiyoon
Copy link
Owner

kiyoon commented Jul 17, 2024

Hi, I'm not sure if I understood it correctly.

How are you connecting it?

I think you should

  1. open jupyter and neovim remotely with nvim --listen localhost:4321
  2. Port forward both 8888 and 4321 so you have access to both neovim and jupyter notebook.
  3. Use jupynium cli. Connect with jupynium --nvim_listen_addr localhost:4321

Is this how you're doing it?

@aaronmlevy
Copy link
Author

Yes, exactly.

Those configurations are definitely correct because I have no problem syncing the first time to an Untitled ipynb.

It's only when I try to sync to existing files that those errors appear.

@kiyoon
Copy link
Owner

kiyoon commented Jul 18, 2024

Thanks for reporting. I honestly haven't been using much remotely and I need to check what's happening. I'll let you know when I do, and sorry for keeping you waiting

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