magma-nvim icon indicating copy to clipboard operation
magma-nvim copied to clipboard

[Bug] <Your title here>

Open yuzhegan opened this issue 1 year ago • 10 comments

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 ':<C-u>MagmaEvaluateVisual<CR>'
  2. See error, with plt.show()

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

Desktop (please complete the following information):

  • OS: [arch]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

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

requirements ~

  • WARNING health#report_start is deprecated, use vim.health.start instead. :help |deprecated| This feature will be removed in Nvim version 0.11
  • OK NeoVim >=0.5
  • WARNING health#report_ok is deprecated, use vim.health.ok instead. :help |deprecated| This feature will be removed in Nvim version 0.11
  • OK Python >=3.8
  • OK Python package pynvim found
  • OK Python package jupyter-client found
  • OK Python package ueberzug found
  • OK Python package Pillow found
  • OK Python package cairosvg found
  • OK Python package pnglatex found
  • OK Python package plotly found
  • OK Python package kaleido found

yuzhegan avatar Jun 04 '23 07:06 yuzhegan

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

yuzhegan avatar Jun 04 '23 07:06 yuzhegan

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

WhiteBlackGoose avatar Jul 04 '23 05:07 WhiteBlackGoose

处理 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 determine_n 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 avatar Jul 17 '23 10:07 yuzhegan

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

yuzhegan avatar Jul 17 '23 10:07 yuzhegan

1689590128953.png

yuzhegan avatar Jul 17 '23 10:07 yuzhegan

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

WhiteBlackGoose avatar Jul 18 '23 07:07 WhiteBlackGoose

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.

yuzhegan avatar Jul 18 '23 12:07 yuzhegan

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.

dmighty007 avatar Sep 02 '23 11:09 dmighty007

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.

yunus-sun avatar Dec 08 '23 09:12 yunus-sun

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

benlubas avatar Dec 12 '23 01:12 benlubas