dccsillag / magma-nvim

Interact with Jupyter from NeoVim.
GNU General Public License v3.0
977 stars 49 forks source link

[Bug] <Your title here> #92

Open yuzhegan opened 1 year ago

yuzhegan commented 1 year ago

Describe the bug A clear and concise description of what the bug is. /outputchunks.py", line 125, in _get_char_pixelsize assert pty is not None

To Reproduce Steps to reproduce the behavior:

  1. Go to ':MagmaEvaluateVisual'
  2. See error, with plt.show()

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

============================================================================== magma: health#magma#check

requirements ~

yuzhegan commented 1 year ago

err detail: Error detected while processing function MagmaTick[1]..remote#define#request: line 2: Error invoking '/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma- nvim/rplugin/python3/magma:function:MagmaTick' on channel 4 (python3-rplugin-ho st): error caught in request handler '/home/david/.config/nvim/dein/repos/github.com /dccsillag/magma-nvim/rplugin/python3/magma:function:MagmaTick [[2]]': Traceback (most recent call last): File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/utils.py", line 13, in inner func(self, *args, **kwargs) File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/init.py", line 414, in function_magma_tick magma.tick() File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/magmabuffer.py", line 132, in tick self.update_interface() File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/magmabuffer.py", line 203, in update_interface self._show_selected(self.selected_cell) File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/magmabuffer.py", line 246, in _show_selected self.outputs[span].show(span.end) File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/outputbuffer.py", line 94, in show chunktext = chunk.place( ^^^^^^^^^^^^ File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/outputchunks.py", line 171, in place nlines = self._determine_n_lines(lineno, shape) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/outputchunks.py", line 144, in _determine_n_lines maybe_pixelsizes = self._get_char_pixelsize() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/david/.config/nvim/dein/repos/github.com/dccsillag/magma-nvim/rpl ugin/python3/magma/outputchunks.py", line 125, in _get_char_pixelsize assert pty is not None ^^^^^^^^^^^^^^^ AssertionError

WhiteBlackGoose commented 1 year ago

Can you give a precise reproduction? EvaluateVisual on its own works for me

yuzhegan commented 1 year ago

处理 CursorMoved 自动命令 ""..function MagmaUpdateInterface[1]..remote#define#request 时发生错误: 第 2 行: Error invoking '/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma:function:MagmaUpdateInterface' on ch annel 7 (python3-rplugin-host): error caught in request handler '/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma:function:MagmaUpdat eInterface [[]]': Traceback (most recent call last): File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/utils.py", line 13, in inner func(self, args, **kwargs) File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/init.py", line 437, in function_update_i nterface self._update_interface() File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/init.py", line 125, in _update_interface

magma.update_interface()

File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 217, in update_interfa ce self._show_selected(self.selected_cell) File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/magmabuffer.py", line 260, in _show_selected

self.outputs[span].show(span.end)

File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/outputbuffer.py", line 94, in show chunktext = chunk.place( ^^^^^^^^^^^^ File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/outputchunks.py", line 171, in place nlines = self._determine_n_lines(lineno, shape) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/outputchunks.py", line 144, in _determinen lines maybe_pixelsizes = self._get_char_pixelsize() ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dav/.local/share/nvim/lazy/magma-nvim/rplugin/python3/magma/outputchunks.py", line 125, in _get_char_pix elsize assert pty is not None ^^^^^^^^^^^^^^^ AssertionError

yuzhegan commented 1 year ago

:python3 from ueberzug.process import get_pty_slave; import os; print(get_pty_slave(os.getppid())) 1689590050272.png

yuzhegan commented 1 year ago

1689590128953.png

WhiteBlackGoose commented 1 year ago

Not the errors, but step by step how to get this error. I could not get it so far

yuzhegan commented 1 year ago

this is my code

import numpy as np
import matplotlib.pyplot as plt

X = np.linspace(-np.pi, np.pi, 256)
C, S = np.cos(X), np.sin(X)

plt.plot(X, C)
plt.plot(X, S)

plt.show()

this is my config :

return {
    -- jupyter nvim
    "dccsillag/magma-nvim",
    build = ":UpdateRemotePlugins",
    config = function()
        vim.cmd([[nnoremap <silent> <leader>mk :MagmaInit Python3<CR>
        nnoremap <silent> <leader>m  :MagmaEvaluateOperator<CR>
        nnoremap <silent> <leader>mm :MagmaEvaluateLine<CR>
        xnoremap <silent> <leader>m  :<C-u>MagmaEvaluateVisual<CR>
        nnoremap <silent> <leader>mc :MagmaReevaluateCell<CR>
        nnoremap <silent> <leader>md :MagmaDelete<CR>
        nnoremap <silent> <leader>mo :MagmaShowOutput<CR>
        nnoremap <silent> <leader>ms :MagmaSave<CR>

        let g:magma_automatically_open_output = v:false
        let g:magma_image_provider = "ueberzug"
        let g:magma_save_path = "~/tmp/magma"

        ]])
    end,
}

when i use "leader"m, then show this error.

dmighty007 commented 12 months ago

Is this solved? Having the same issue. Code runs well, but image (by matplotlib or seaborn etc) does not show, rather throws this error. Previously having error in wayland but persists in Xorg as well.

yunus-sun commented 8 months ago

Is this solved? Having the same issue. Code runs well, but image (by matplotlib or seaborn etc) does not show, rather throws this error. Previously having error in wayland but persists in Xorg as well.

Same Issue for me.

benlubas commented 8 months ago

You can try https://github.com/benlubas/molten-nvim, I forked this plugin and fixed up a bunch of things, added a bunch too. It uses Image.nvim to render images (which in turn uses either Uberzug++ or Kitty Graphics Protocol), and it's much less buggy in my experience. @yunus-sun @dmighty007