w3x-to-vmf icon indicating copy to clipboard operation
w3x-to-vmf copied to clipboard

ui.py throws a MemoryError when creating a topdown picture for specific maps

Open RenolY2 opened this issue 11 years ago • 2 comments

In some cases it can happen that ui.py throws a MemoryError when opening some bigger maps and creating a topdown picture for them. This doesn't happen for everybody (e.g. I can open the Trolls'n Elves map just fine, but when SinZ does the same, a MemoryError is raised).

It doesn't appear to happen when running the topdown viewer on the map directly.

RenolY2 avatar Feb 15 '14 09:02 RenolY2

Loading war3map_troll.w3e

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in __call__
    return self.func(*args)
  File "C:\Users\SinZ\Documents\GitHub\w3x-to-vmf\ui.py", line 95, in openFile
    self.topDownTab.setImage(topdownImage)
  File "C:\Users\SinZ\Documents\GitHub\w3x-to-vmf\ui.py", line 148, in setImage
    self.img = ImageTk.PhotoImage(img)
  File "C:\Python27\lib\site-packages\PIL\ImageTk.py", line 113, in __init__
    self.paste(image)
  File "C:\Python27\lib\site-packages\PIL\ImageTk.py", line 172, in paste
    block = image.new_block(self.__mode, im.size)
MemoryError

SinZ163 avatar Feb 17 '14 08:02 SinZ163

same for zoom in as it is for zoom out (on wc3map.w3e)

Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 1470, in __call__
    return self.func(*args)
  File "C:\Users\SinZ\Documents\GitHub\w3x-to-vmf\ui.py", line 160, in zoomIn
    self.img = ImageTk.PhotoImage(img)
  File "C:\Python27\lib\site-packages\PIL\ImageTk.py", line 110, in __init__
    self.__photo = tkinter.PhotoImage(**kw)
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 3306, in __init__
    Image.__init__(self, 'photo', name, cnf, master, **kw)
  File "C:\Python27\lib\lib-tk\Tkinter.py", line 3262, in __init__
    self.tk.call(('image', 'create', imgtype, name,) + options)
TclError: not enough free memory for image buffer

Note, the computer isn't out of RAM, it is simply python not wanting to use more

SinZ163 avatar Feb 17 '14 08:02 SinZ163