b-init / ImagePaste

A simple Blender addon to grab images from your clipboard and paste as a reference image in viewport or onto the image editor.
GNU General Public License v3.0
251 stars 9 forks source link

BUG: Dont paste image #43

Closed b4zz4 closed 1 year ago

b4zz4 commented 1 year ago

Describe the bug

Dont paste image

Step to reproduce

Paste image

Relevant log output

Python: Traceback (most recent call last):
  File "/home/bazza/.config/blender/3.4/scripts/addons/ImagePaste-main/imagepaste/operators.py", line 184, in execute
    clipboard = Clipboard.push(get_save_directory())
  File "/home/bazza/.config/blender/3.4/scripts/addons/ImagePaste-main/imagepaste/clipboard/linux/linux.py", line 48, in push
    process = Process.execute(cls.get_xclip_args())
  File "/home/bazza/.config/blender/3.4/scripts/addons/ImagePaste-main/imagepaste/process.py", line 69, in execute
    popen, stdout, stderr = comunicate(process.parameters)
  File "/home/bazza/.config/blender/3.4/scripts/addons/ImagePaste-main/imagepaste/process.py", line 52, in comunicate
    stdout, stderr = popen.communicate()
  File "/usr/lib/python3.10/subprocess.py", line 1154, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.10/subprocess.py", line 2043, in _communicate
    stdout = self._translate_newlines(stdout,
  File "/usr/lib/python3.10/subprocess.py", line 1031, in _translate_newlines
    data = data.decode(encoding, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Expected behavior

paste image

Platform

Linux

Platform version

Blender 3.4 - Arch Linux

Blender version

Other

b-init commented 1 year ago

Where did you copy the image from? Have you tried Images copied from other sources (Web Browser, Screenshot, files)?

b4zz4 commented 1 year ago

I copy the image of the Gimp, Krita, File and Browser I think it's a python encoding problem, it doesn't accept the Unicode

thanhph111 commented 1 year ago

I think you are using Wayland as the default display server which hasn't been supported yet. Can you check with echo $XDG_SESSION_TYPE from command line?

b4zz4 commented 1 year ago
echo $XDG_SESSION_TYPE
x11
thanhph111 commented 1 year ago

Interesting. However, it's pretty hard to reproduce for me as I'm not quite familiar with Arch. If you're interested, you could help us debug by playing with xclip to check if all processes are working fine, because the add-on uses xclip under the hood when it's on Linux.

b4zz4 commented 1 year ago

Yeah, tell me what to do

thanhph111 commented 1 year ago

Awesome, great to hear that.

Firstly, you need to start Blender from the command line to get the logs from the ImagePaste add-on. Add some print statements to the imagepaste/process.py file in the add-on directory (~/.config/blender/3.4/scripts/addons/ImagePaste-main), reload scripts, and try to reproduce the bug to get the xclip command that causes the error. Test that command using the command line to determine if the issue is on the Python side or the xclip side.

Let me know if you get stuck.

b4zz4 commented 1 year ago

Oh!, The problem is only in the 2D Grease Pencil animation layout

b4zz4 commented 1 year ago

Solved!, I can't hold an object while I hit the picture. Error is a little confusing because it says they don't have a picture.

thanhph111 commented 1 year ago

Make sense. I should have had an exception handling there. BTW, glad to hear your problem solved.