Forum Archive

v2.0 vs v2.1 : hard crash using "reserved" var names ?

BillBaroude

Hi there,

Going forward to 2.1 from 2.0, I have a bunch of "hard crashes" (direct go back to ios, no error, no message) when using certain var names in my scripts (working on 2.0)

I had tracked the issue and discovered that vars names like "self.target" in scene produce 100% the crash, but using "self.Target" works.
It's probably a deep exception.

Any fix possible ?

Thanks

BillBaroude

More info, going deeper in my searches :

  • It looks like to crash only if files had been created with 2.0 using the Game/Animation template. If the file is created with 2.1 with the template it works.
  • If the file is edited using Sublime Text on Mac, it works after transfer (via drop box) on iPhone

It looks like a text formatting issue...

Here is the code (but should probably not produce the crash because of text copy/past from the .py file to this page):

#This guy produces an hard crash on v2.1

from scene import *
import sound
import random
import math
#import photos

class MyScene (Scene):
    def setup(self):
        self.background_color = '#ffffff'

        self.target = SpriteNode('iob:ionic_256')

        self.add_child(self.target)

        pass

    def did_change_size(self):
        pass

    def update(self):

        pass

    def touch_began(self, touch):
        pass

    def touch_moved(self, touch):
        pass

    def touch_ended(self, touch):
        pass

if __name__ == '__main__':
    run(MyScene(), PORTRAIT, show_fps=True)

Do other people are facing this ?
Thanks

BillBaroude

and at least : after verification ,code copied from this page produces the crash too.

ccc

Minimal example that also crashes 2.1:

import scene

class MyScene(scene.Scene):
    def setup(self):
        self.target = scene.SpriteNode('iob:alert_circled_256', parent=self)

if __name__ == '__main__':
    scene.run(MyScene(), show_fps=False)
omz

I've created an issue in the new bugtracker for this: https://github.com/omz/Pythonista-Issues/issues/19

Oscar

I don't know if it is related, but I am encountering a crash with a very similar piece of code, but not for code completion. This crashes when it is run:

# coding: utf-8

from scene import *
import sound
import random
import math
A = Action

class MyScene (Scene):
    def setup(self):
                #Does not crash 
        SpriteNode('emj:Airplane', position=self.size/2, parent=self)
                # Will crash
        SpriteNode('iow:alert_256', position=self.size/2, parent=self)

if __name__ == '__main__':
    run(MyScene(), show_fps=False)

It's always crashing for me on Python 2.1, but not on Python 3.0. I assumed it had to do with some of the built-in image collections somehow.

omz

It seems like this is a problem with some of the built-in image collections being compressed too aggressively in 2.1, which apparently leads to issues with loading OpenGL textures. I'm not exactly sure why this is, but the problem seems to go away entirely when I replace the image collections in 2.1 with those from 3.0 – the content is the same, but the size of the app will go up very slightly as a result of the fix.

I haven't always been able to reproduce the crash; it sometimes worked, and when it worked, it usually did until restarting the app (as loaded images/textures are cached). So I think the initial suspicion about certain variable names or text formatting issues might have been a red herring.