Annoying message when opening windows from Python on OS X 10.8 Annoying message when opening windows from Python on OS X 10.8 python python

Annoying message when opening windows from Python on OS X 10.8


The correct command to run is:

defaults write org.python.python ApplePersistenceIgnoreState NO

This message appears due to the "application resume" feature in newer versions of OS X. Clearly, this isn't a useful feature for most Python programs (in my case, plotting data with matplotlib), so we can just turn it off with the above command.

For more information on what defaults write is actually doing, check out the man page.


Answering my own question, with thanks to @Steve Barnes for giving me a hint. It seems this problem can be solved with the terminal command

$ defaults write org.python.python ApplePersistenceIgnoreState NO

In the comments, Greg Coladonato reports that, in 2020, running Python 3, this may need to be changed to

$ defaults write org.python.python3 ApplePersistenceIgnoreState NO

I am not sure exactly how this command operates, but having done it some time ago I have observed no ill effects.

Note however, that another user has pointed out that this can cause a bug with python 3.4 on mountain lion where tkinter dialogs do not close when a button is pressed as one would expect.

$ defaults write org.python.python ApplePersistenceIgnoreState YES

will undo the command if you experience problems. (Replacing org.python.python with org.python.python3 if needed.)


When running an anaconda python distribution, a slightly different write is needed:

defaults write com.continuum.python ApplePersistenceIgnoreState NO