Glyphs app crashes when using Window isntead of FloatingWindow – Vanilla

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = FloatingWindow((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.button = Button((10, 10, -10, 20), "A Button",
                           callback=self.buttonCallback)
        self.w.open()

    def buttonCallback(self, sender):
    	aString = "/a/b /c/d /eth/a /b/c"
        Glyphs.currentDocument.windowController().addTabWithString_(aString)

WindowDemo()

The above script runs, the one below crashes, the only difference is one is using Window:

from vanilla import *

class WindowDemo(object):

    def __init__(self):
        self.w = Window((200, 70), "Window Demo")
        self.w.myButton = Button((10, 10, -10, 20), "My Button")
        self.w.button = Button((10, 10, -10, 20), "A Button",
                           callback=self.buttonCallback)
        self.w.open()

    def buttonCallback(self, sender):
    	aString = "/a/b /c/d /eth/a /b/c"
        Glyphs.currentDocument.windowController().addTabWithString_(aString)

WindowDemo()

Why? I want to use a normal window so I can minimise my script
And is there a way to stop Glyphs App crashing so that I can see the error message…?

It works for me.

What version of Glyphs do you have?

Do you run it from a script or the Macro panel? The later does not support scripts with UI.

Even in a script, v2.0.1, (736) on OS X 10.9.5
I just sent a crash report too

You can try to redirect the script output to the console.app. Check the box in Preferences and restart the app.

I’m having a similar problem.
My script before using vanilla works fine, I’ve added vanilla and when I press the button that execute the function, the app crashes. Any idea why this could be happen?
I’m on the last version of Glyphs (not cutting edge) running the script from a .py file inside the scripts folder.

Thanks in advance!

Does it work in the cutting edge version?

I’ve updated the app and I fixed a bug with an unassigned variable, and the problem was solved. Is there a kind of cache with the variables?

Thanks!

I believe global variables and loaded classes remain in memory, yes.

For this kind of problems it sometimes helps do direct the script output to the system console app because you will be able to read the last error message of the script.