'NoneType' object has no attribute 'mutated_surface'

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Message
Author
User avatar
Eliont
Regular
Posts: 89
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart"
Projects: Legends of Alkion
Location: Russia
Contact:

'NoneType' object has no attribute 'mutated_surface'

#1 Post by Eliont » Sat Dec 31, 2016 9:17 am

Hello and happy New Year to everyone. Got an error in new version, before update worked just fine.

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 12, in script
    python:
  File "game/script.rpy", line 79, in <module>
    base = Base() # основной класс участка
  File "game/script/core - classes.rpy", line 73, in __init__
    self.pc = Hero(datafolder='content/unique_characters/hero')
  File "game/script/dungeon - classes.rpy", line 77, in __init__
    self.skills[entry] = Skill(data[entry],path)
  File "game/script/dungeon - classes.rpy", line 398, in __init__
    self.icon = ProportionalScale(self.iconfile,100,100)
  File "game/lib/lib - common.rpy", line 299, in ProportionalScale
    currentwidth, currentheight = get_size(img)
  File "game/lib/lib - common.rpy", line 321, in get_size
    w, h = renpy.render(d, 0, 0, 0, 0).get_size()
AttributeError: 'NoneType' object has no attribute 'mutated_surface'

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "D:\Soft\renpy-6.99.11-sdk\renpy\bootstrap.py", line 290, in bootstrap
    renpy.main.main()
  File "D:\Soft\renpy-6.99.11-sdk\renpy\main.py", line 487, in main
    run(restart)
  File "D:\Soft\renpy-6.99.11-sdk\renpy\main.py", line 147, in run
    renpy.execution.run_context(True)
  File "D:\Soft\renpy-6.99.11-sdk\renpy\execution.py", line 761, in run_context
    context.run()
  File "game/script.rpy", line 12, in script
    python:
  File "D:\Soft\renpy-6.99.11-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\Soft\renpy-6.99.11-sdk\renpy\python.py", line 1695, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 79, in <module>
    base = Base() # основной класс участка
  File "game/script/core - classes.rpy", line 73, in __init__
    self.pc = Hero(datafolder='content/unique_characters/hero')
  File "game/script/dungeon - classes.rpy", line 77, in __init__
    self.skills[entry] = Skill(data[entry],path)
  File "game/script/dungeon - classes.rpy", line 398, in __init__
    self.icon = ProportionalScale(self.iconfile,100,100)
  File "game/lib/lib - common.rpy", line 299, in ProportionalScale
    currentwidth, currentheight = get_size(img)
  File "game/lib/lib - common.rpy", line 321, in get_size
    w, h = renpy.render(d, 0, 0, 0, 0).get_size()
  File "renpy/display/render.pyx", line 103, in renpy.display.render.render (gen\renpy.display.render.c:3321)
    cpdef render(d, object widtho, object heighto, double st, double at):
  File "renpy/display/render.pyx", line 185, in renpy.display.render.render (gen\renpy.display.render.c:2859)
    rv = d.render(widtho, heighto, st, at)
  File "D:\Soft\renpy-6.99.11-sdk\renpy\display\im.py", line 473, in render
    im = cache.get(self)
  File "D:\Soft\renpy-6.99.11-sdk\renpy\display\im.py", line 217, in get
    renpy.display.render.mutated_surface(ce.surf)
  File "renpy/display/render.pyx", line 401, in renpy.display.render.mutated_surface (gen\renpy.display.render.c:6511)
    renpy.display.draw.mutated_surface(surf)
AttributeError: 'NoneType' object has no attribute 'mutated_surface'

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.2.2029
Legends_of_Alkion 1.0


Referring function:

Code: Select all

    def ProportionalScale(img, maxwidth, maxheight):
        currentwidth, currentheight = get_size(img)
        xscale = float(maxwidth) / float(currentwidth)
        yscale = float(maxheight) / float(currentheight)
        
        if xscale < yscale:
            minscale = xscale
        else:
            minscale = yscale
            
        newwidth = currentwidth * minscale
        newheight = currentheight * minscale
        
        return im.FactorScale(img,minscale,minscale)

        
    def resize(img, x=400, y=400):        
        return ProportionalScale(img, x, y)     
    
    
    def get_size(d):
        d = renpy.easy.displayable(d)
        w, h = renpy.render(d, 0, 0, 0, 0).get_size()
        w, h = int(round(w)), int(round(h))
        return w, h


Thanks in advance.

User avatar
PyTom
Ren'Py Creator
Posts: 15443
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: 'NoneType' object has no attribute 'mutated_surface'

#2 Post by PyTom » Sat Dec 31, 2016 8:38 pm

Can you send me a short replication of this bug? There isn't a clear cause of this problem, so I'd need to poke around and see it in action to find out what's going wrong.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

city
Newbie
Posts: 23
Joined: Mon Jul 04, 2016 6:30 pm
Contact:

Re: 'NoneType' object has no attribute 'mutated_surface'

#3 Post by city » Sun Jan 01, 2017 3:34 am

I updated to .12 and sent out almost an identical build that I made with .11, and got this error in multiple places:

AttributeError: 'NoneType' object has no attribute '_in_current_store'

I had no idea what to do so I reverted to .11, built it again, and it seems to work fine.

User avatar
Eliont
Regular
Posts: 89
Joined: Thu Aug 06, 2009 6:51 am
Completed: Begin of Evangelion, SAO - Smile of the black cat, SAO - Project "Ceramic Heart"
Projects: Legends of Alkion
Location: Russia
Contact:

Re: 'NoneType' object has no attribute 'mutated_surface'

#4 Post by Eliont » Mon Jan 02, 2017 9:13 am

Sorry for late answer.
It seems bug occured in line "renpy.render(d, 0, 0, 0, 0).get_size()" what needed to determine h/w of picture to fit it to frame afterwards.

Using pre-scaled images is not a option.

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: 'NoneType' object has no attribute 'mutated_surface'

#5 Post by Nazon » Tue Jan 31, 2017 9:07 am

I have the same problem('NoneType' object has no attribute 'mutated_surface') with the get_size finction.

Code: Select all

    def get_size(d):
        d = renpy.easy.displayable(d)
        w, h = renpy.render(d, 0, 0, 0, 0).get_size()
        w, h = int(round(w)), int(round(h))
        return w, h
May be it related to the image transparency somehow?
It works for some images, but failed for others.

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: 'NoneType' object has no attribute 'mutated_surface'

#6 Post by xela » Tue Jan 31, 2017 12:53 pm

PyTom wrote:Can you send me a short replication of this bug? There isn't a clear cause of this problem, so I'd need to poke around and see it in action to find out what's going wrong.
They are attempting to get a size of a render during init phase, which worked in the past but throws a couple of different errors in newer versions.
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users