image-occlusion-2 icon indicating copy to clipboard operation
image-occlusion-2 copied to clipboard

cannot identify image file

Open lucidl opened this issue 12 years ago • 7 comments

When I installed this addon from this link https://ankiweb.net/shared/info/282798835 and choose "add" -> button with "image occlusion" I get the following error. Where could be the problem? (Ubuntu 12.04)

An error occurred in an add-on. Please contact the add-on author.

Traceback (most recent call last): File "/home/lucidl/Anki/addons/image_occlusion_2/image_occlusion.py", line 86, in add_notes self.call_ImageOcc_Editor(image_path) File "/home/lucidl/Anki/addons/image_occlusion_2/image_occlusion.py", line 98, in call_ImageOcc_Editor d = svgutils.image2svg(path) File "/home/lucidl/Anki/addons/image_occlusion_2/svgutils.py", line 54, in image2svg im = Image.open(im_path) File "/home/lucidl/Anki/addons/image_occlusion_2/Imaging/PIL/Image.py", line 1980, in open raise IOError("cannot identify image file") IOError: cannot identify image file

lucidl avatar Jan 27 '13 10:01 lucidl

I'm just a user, so just suggesting ;-) Did you try different pictures? "cannot identify image file" sounds like you tried to use an image format ImageOcc cannot understand.

Regards,

Oliver

oli-ver avatar Jan 27 '13 16:01 oli-ver

I'm doing everything as in this tutorial http://youtu.be/2xYWIv8ksqg .The problem happens short after time 2:19 I click on "image occlusion" button as in the video and at this moment the exception is raised. There is no image selected yet.

lucidl avatar Jan 27 '13 17:01 lucidl

Tried it in my Ubuntu 12.04 VM. I could add one of the Cards with Image Occlusion without any problems. I had a picture saved in clipboard.

After that I wanted to choose a picture from a folder. When I clicked on the "Image Occlusion" button I got exactly the same error message. Trying for another time it worked again perfectly...

Now, after restarting Anki I got the error message all the time.

I opened a terminal and updated the system:

  sudo apt-get update
  sudo apt-get upgrade
  sudo reboot

And ... it did not work either.

I opened the python-Skript that is shown in the error message (you will have to change it to your user):

gedit /home/oliver/Anki/addons/image_occlusion_2/Imaging/PIL/Image.py

Then I used the menu function to navigate to line 1980 (Ctrl+i). I did not understand the reason to raise the IOError there, so I deleted the whole line

 raise IOError("cannot identify image file")

and saved.

Now it works... Don't ask me why ;-) Checked it with images in clipboard and images from files.

I hope this will help,

Regards,

Oliver

oli-ver avatar Jan 27 '13 20:01 oli-ver

The commenting of line 1980: raise IOError("cannot identify image file") was the first thing I did then and it did not helped then. But now I did it again and it helped. It works now, maybe it's because I installed the addon svg-edit (http://code.google.com/p/svg-edit/) in Firefox.

lucidl avatar Jan 28 '13 11:01 lucidl

Well, I didn't install anything, just Ubuntu 12.04 and all updates and Anki. But anyway, it works! That counts ;)

oli-ver avatar Jan 28 '13 11:01 oli-ver

I have the same issue except commenting out the line in Image.py did not solve the issue, it just caught errors elsewhere. If I delete the add-on, restart anki, add the add-on, restart anki then I can make 1 image occlusion. When I attempt to make a second one, I get this error even if I restart anki. Rob

elrob avatar Mar 28 '13 12:03 elrob

I can confirm I get this error on ubuntu installed at uni, and on linux mint (basically ubuntu) at home. However, I don't get this problem on windows. I'm now forced to use windows as I've really got into making image occlusion cards. It's a great add-on but it would be much better if this error didn't occur on linux.

elrob avatar Mar 31 '13 13:03 elrob