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

Jupynium server stop as long as I save the *.ju.py file #114

Closed
githubjacky opened this issue Apr 29, 2024 · 9 comments · Fixed by #115
Closed

Jupynium server stop as long as I save the *.ju.py file #114

githubjacky opened this issue Apr 29, 2024 · 9 comments · Fixed by #115
Labels
bug Something isn't working

Comments

@githubjacky
Copy link

githubjacky commented Apr 29, 2024

First of all, thank you for creating such a beautiful plugin. I really appreciate your work.

Describe the bug
Can't save the *.ju.py while editing.

To Reproduce

  1. ssh port forwarding for both nvim_listen_addr and notebook_URL
  2. open the neovim and start the jupyter server in remote
  3. open the jupynium server in local computer(no problem here)
  4. save the *.ju.py file

Expected behavior
Jupynium server should not stop

Logs in /tmp/jupynium/logs/

jupynium.events_control: 197 - INFO - Event from nvim: Notification(type='notification', name='BufWritePre' jupynium.cmds.jupynium: 559 - INFO - Nvim has been closed. Detaching nvim.

Output of jupynium --version

Jupynium v0.2.2

Output of nvim --version

NVIM v0.9.5
Build type: Release
LuaJIT 2.1.1692716794

Additional context

@githubjacky githubjacky added the bug Something isn't working label Apr 29, 2024
@kiyoon
Copy link
Owner

kiyoon commented Apr 29, 2024

Hi, did you save and close nvim? If the controlling nvim is no longer available, it will detach nvim.

@githubjacky
Copy link
Author

githubjacky commented Apr 29, 2024

Thanks for your reply! I didn't close the nvim. I just saved it.

P.S. I add more steps to reproduce the issue. Is it possible that the issue is actually related to ssh forwarding?

@kiyoon
Copy link
Owner

kiyoon commented Apr 29, 2024

Unfortunately the log isn't very helpful in this case.. According to it, while running process_notification_event() in src/jupynium/event_control.py, it threw an OSError somewhere thus logging Nvim has been closed. Detaching nvim. in line 559 of src/jupynium/cmds/jupyniu.py. Is it possible for you to debug the code a little and let me know where the error is happening?

@kiyoon
Copy link
Owner

kiyoon commented Apr 29, 2024

Before that, can you set auto_download_ipynb = false, in the jupynium settings? It might be due to that functionality.

@kiyoon
Copy link
Owner

kiyoon commented Apr 29, 2024

I think I get what's going wrong.. You're editing a file e.g. /home/user/a.ju.py in a server, and jupynium is trying to download ipynb to the local /home/user/a.ipynb. And when the local directory doesn't exist, it throws an OSError.

@githubjacky
Copy link
Author

githubjacky commented Apr 29, 2024

Exactly! If I set auto_download_ipynb = false, I can save the *.ju.py file correctly! Thanks for your help!

@kiyoon
Copy link
Owner

kiyoon commented Apr 29, 2024

Thanks for reporting the bug! If you find time, it would be helpful to test if #115 works well. You can install the branch fix/download-ipynb-exception.

@githubjacky
Copy link
Author

githubjacky commented Apr 30, 2024

No problem. After installing the PyPI package from that branch, I can save the *.ju.py file and the log that is generated after saving the file:

jupynium.events_control: 197 - INFO - Event from nvim: Notification(type='notification', name='BufWritePre', args=[1, '{ path }'])

jupynium.events_control: 673 - WARNING - Failed to auto-download ipynb with error: [Errno 2] No such file or directory: '{ path }'.
Maybe a remote nvim is used and the path { path } is not accessible on the local machine.

Note: { path } is the path of the jupyter notebook attach to the nvim

@kiyoon
Copy link
Owner

kiyoon commented Apr 30, 2024

Thanks for testing! Looks good to go.

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