I kill Python processes with SIGQUIT by pressing Ctrl\ sometimes (usually my own that are misbehaving). Can I prevent the "Python quit unexpectedly" message? I know I can just hit escape, so it's not so bad.
3 Answers
If you never want to see the crash report dialogs, there is a preference to disable them:
defaults write com.apple.CrashReporter DialogType none
Log out and back in to apply the changes.
-
2
-
7Is there a way to do the
defaults write com.apple.CrashReporter DialogType none
selectively for one particular app only? Dec 29, 2015 at 20:49 -
For me this behavior didn't change (after entering the command) until logout and log in. Sep 23, 2019 at 9:33
You can also make the message appear as a notification instead:
defaults write com.apple.CrashReporter UseUNC 1
-
2Like this one. On macOS Sierra a notification banner slides over at the top right of the screen and will disappear on its own but if you click it you get the original full crash dump window. So this is perfect. Much less obtrusive but leaves options open. Feb 4, 2017 at 8:38
The default behavior when receiving SIGQUIT is to dump core and exit; the crash reporter is triggered as a part of this process.
Starting with 10.5(?) simply setting a signal handler for SIGQUIT should be sufficient to avoid the crash reporter; you will probably want the handler to also call exit.
import signal, sys, os
def sigquit_handler(signum, frame):
print 'SIGQUIT received; exiting'
sys.exit(os.EX_SOFTWARE)
signal.signal(signal.SIGQUIT, sigquit_handler)
# Do your normal work instead of this
print 'Waiting for a signal...'
signal.pause()
The above code was tested on 10.8.5 against /usr/bin/python
which is 2.7.2.
-
1Is there a way to do the
defaults write com.apple.CrashReporter DialogType none
selectively for one particular app only? Dec 29, 2015 at 20:49
t.daemon = True
on these, and I am for the most part) For various reasons, sometimes I need to use ctrl-\.