tmbb / image-occlusion-2

Image Occlusion addon for Anki
30 stars 10 forks source link

'NoneType' object has no attribute 'size' #3

Open lucidl opened 11 years ago

lucidl commented 11 years ago

When I choose "add" -> button with "image occlusion" I get the following error. Where could be the problem? (Ubuntu 12.04). Sometimes helpes restarting the computer, sometimes it corrects after some time period, now the problem lasts and I can't get rid off it.

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 55, in image2svg width, height = im.size AttributeError: 'NoneType' object has no attribute 'size'

lucidl commented 11 years ago

I changed the code as follows: It seems that the problem was something with clipboard. def add_notes(self):

clip = QApplication.clipboard()

    #if clip.mimeData().imageData():
        #handle, image_path = tempfile.mkstemp(suffix='.png')
        #clip.image().save(image_path)
        #self.image_path = image_path
        #clip.clear()
        #self.call_ImageOcc_Editor(image_path)
    #else:
    image_path = QtGui.QFileDialog.getOpenFileName(None, # parent
                                                   FILE_DIALOG_MESSAGE,
                                                   os.path.expanduser('~'),
                                                   FILE_DIALOG_FILTER)
    if image_path:
      self.image_path = image_path
      self.call_ImageOcc_Editor(image_path)          
cicabum commented 11 years ago

What file should i change? I have the same problem :-(

lucidl commented 11 years ago

I commented lines 80 .. 88 in file Anki/addons/image_occlusion_2/image_occlusion.py, you can see them in my previous post (Commented lines begin with #)