wx.lib.agw.thumbnailctrl (IO Error and other problems)

Hello,

I’m trying to use wx.lib.agw.thumbnailctrl but I got, randomly, several crashes:

  • python: Fatal IO error 11 (El recurs no es troba disponible temporalment) on X server :0.0.
  • python: Fatal IO error 0 (El recurs no es troba disponible temporalment) on X server :0.0.
  • A X server frozen

I’m running ubuntu 14.04 with:

  • Python 2.7.6
  • wx-2.8-gtk2-unicode
  • Pillow 1.1.7

Originally I’veen trying to use a inherited class from ThumbnailCtrl. Thinking that the crash where caused by my code. I discarded my inheritance and all my code and get trying with the demo downloaded from here: https://groups.google.com/group/wxpython-users/attach/3b5f2e5d303d1eb/ThumbnailCtrl.zip?part=0.1&authuser=0&view=1

Replacing the 4th line to use the ThumbnailCtrl distributed with wxPython:

import wx.lib.agw.thumbnailctrl as TC

While the image list is short enough, it runs well, but when the list is more large, I’ve got the same issue… :frowning:

Could someone help me to get this component working?

Tank you,

···

Ok, I’ve got it… it’s caused by the old thread and it’s use… one approach could be using the new threading, process, multiprocessing, …

Here’s a little (improvable) patch, that works for me:

— /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/agw/thumbnailctrl.py.old
+++ /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/agw/thumbnailctrl.py
@@ -137,7 +137,7 @@
import cStringIO
import zlib

-import thread
+import threading
from math import pi

from wx.lib.embeddedimage import PyEmbeddedImage
@@ -1460,7 +1460,6 @@

         if not self._isrunning:
             self._isrunning = False
  •            thread.exit()
               return
    
           self.LoadImages(filenames[count], count)
    

@@ -1472,8 +1471,6 @@
count = count + 1

     self._isrunning = False
  •    thread.exit()
    
···
 def LoadImages(self, newfile, imagecount):
     """

@@ -1484,7 +1481,6 @@
“”"

     if not self._isrunning:
  •        thread.exit()
           return
    
       img, originalsize, alpha = self._imageHandler.LoadThumbnail(newfile, (300, 240))
    

@@ -1519,8 +1515,9 @@
newfiles = SortFiles(items, self._items, myfiles)
self._isrunning = True

  •    thread.start_new_thread(self.ThreadImage, (newfiles,))
    
  •    wx.MilliSleep(20)
    
  •    t = threading.Thread(target=self.ThreadImage, args=(newfiles,))
    
  •    t.start()
    
  •    t.join()
    
       self._selectedarray = []
       self.UpdateProp()
    

El domingo, 10 de mayo de 2015, 18:30:44 (UTC+2), Javier Pais escribió:

Hello,

I’m trying to use wx.lib.agw.thumbnailctrl but I got, randomly, several crashes:

  • python: Fatal IO error 11 (El recurs no es troba disponible temporalment) on X server :0.0.
  • python: Fatal IO error 0 (El recurs no es troba disponible temporalment) on X server :0.0.
  • A X server frozen

I’m running ubuntu 14.04 with:

  • Python 2.7.6
  • wx-2.8-gtk2-unicode
  • Pillow 1.1.7

Originally I’veen trying to use a inherited class from ThumbnailCtrl. Thinking that the crash where caused by my code. I discarded my inheritance and all my code and get trying with the demo downloaded from here: https://groups.google.com/group/wxpython-users/attach/3b5f2e5d303d1eb/ThumbnailCtrl.zip?part=0.1&authuser=0&view=1

Replacing the 4th line to use the ThumbnailCtrl distributed with wxPython:

import wx.lib.agw.thumbnailctrl as TC

While the image list is short enough, it runs well, but when the list is more large, I’ve got the same issue… :frowning:

Could someone help me to get this component working?

Tank you,

I forgot to attach the patch file, here it is!

parche.diff (1.21 KB)

···

El lunes, 11 de mayo de 2015, 10:17:02 (UTC+2), Javier Pais escribió:

Ok, I’ve got it… it’s caused by the old thread and it’s use… one approach could be using the new threading, process, multiprocessing, …

Here’s a little (improvable) patch, that works for me:

— /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/agw/thumbnailctrl.py.old
+++ /usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode/wx/lib/agw/thumbnailctrl.py
@@ -137,7 +137,7 @@
import cStringIO
import zlib

-import thread
+import threading
from math import pi

from wx.lib.embeddedimage import PyEmbeddedImage
@@ -1460,7 +1460,6 @@

         if not self._isrunning:
             self._isrunning = False
  •            thread.exit()
               return
    
           self.LoadImages(filenames[count], count)
    

@@ -1472,8 +1471,6 @@
count = count + 1

     self._isrunning = False
  •    thread.exit()
    
 def LoadImages(self, newfile, imagecount):
     """

@@ -1484,7 +1481,6 @@
“”"

     if not self._isrunning:
  •        thread.exit()
           return
    
       img, originalsize, alpha = self._imageHandler.LoadThumbnail(newfile, (300, 240))
    

@@ -1519,8 +1515,9 @@
newfiles = SortFiles(items, self._items, myfiles)
self._isrunning = True

  •    thread.start_new_thread(self.ThreadImage, (newfiles,))
    
  •    wx.MilliSleep(20)
    
  •    t = threading.Thread(target=self.ThreadImage, args=(newfiles,))
    
  •    t.start()
    
  •    t.join()
    
       self._selectedarray = []
       self.UpdateProp()
    

El domingo, 10 de mayo de 2015, 18:30:44 (UTC+2), Javier Pais escribió:

Hello,

I’m trying to use wx.lib.agw.thumbnailctrl but I got, randomly, several crashes:

  • python: Fatal IO error 11 (El recurs no es troba disponible temporalment) on X server :0.0.
  • python: Fatal IO error 0 (El recurs no es troba disponible temporalment) on X server :0.0.
  • A X server frozen

I’m running ubuntu 14.04 with:

  • Python 2.7.6
  • wx-2.8-gtk2-unicode
  • Pillow 1.1.7

Originally I’veen trying to use a inherited class from ThumbnailCtrl. Thinking that the crash where caused by my code. I discarded my inheritance and all my code and get trying with the demo downloaded from here: https://groups.google.com/group/wxpython-users/attach/3b5f2e5d303d1eb/ThumbnailCtrl.zip?part=0.1&authuser=0&view=1

Replacing the 4th line to use the ThumbnailCtrl distributed with wxPython:

import wx.lib.agw.thumbnailctrl as TC

While the image list is short enough, it runs well, but when the list is more large, I’ve got the same issue… :frowning:

Could someone help me to get this component working?

Tank you,