TobinPalmer / pastify.nvim

Paste images into markdown from neovim
The Unlicense
64 stars 12 forks source link

NotImplementedError: ImageGrab.grabclipboard() is macOS and Windows only #3

Open oxio2 opened 1 year ago

oxio2 commented 1 year ago

My img-paste.lua config file inside lazyvim configs

return {
  -- add symbols-outline
  {
    "TobinPalmer/pastify.nvim",
    config = function()
      require("pastify").setup({
        opts = {
          absolute_path = false, -- use absolute or relative path to the working directory
          apikey = "", -- Api key, required for online saving
          local_path = "/assets/imgs/", -- The path to put local files in, ex ~/Projects/<name>/assets/images/<imgname>.png
          save = "local", -- Either 'local' or 'online'
        },
        ft = { -- Custom snippets for different filetypes, will replace $IMG$ with the image url
          html = '<img src="$IMG$" alt="">',
          markdown = "![]($IMG$)",
          tex = [[\includegraphics[width=\linewidth]{$IMG$}]],
        },
      })
    end,
  },
}

Error message when executing the command :Pastify

Error invoking 'python_execute' on channel 3 (python3-script-host):
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/oxio2/.local/share/nvim/lazy/pastify.nvim/python3/pastify/main.py", line 30, in paste_text
    img = ImageGrab.grabclipboard()
  File "/usr/lib/python3/dist-packages/PIL/ImageGrab.py", line 120, in grabclipboard
    raise NotImplementedError("ImageGrab.grabclipboard() is macOS and Windows only")
NotImplementedError: ImageGrab.grabclipboard() is macOS and Windows only

NotImplementedError: ImageGrab.grabclipboard() is macOS and Windows only

It looks like the functionality only works on macOS and Windows, is this an error associated with my machine/configs or does the plugin not support linux at all? If this is the case, will the plugin support linux in the future?

TobinPalmer commented 1 year ago

Probably not in the future sorry, I will add this to the readme that it is only for macOS and Windows sorry.

superzanti commented 5 months ago

As per the docs and the github - The ImageGrab function should be supported on linux so long as xclip or wl-paste is isntalled

TobinPalmer commented 5 months ago

@oxio2 if you’d like to retry ensuring you have xclip or wl-paste installed that would be great.