I was wondering if there is a way to make Eclipse or PyDev play a sound if the console registers an exception and breaks the script?
I assume I could do something along these lines:
try:
function_name()
except Exception as exception_data:
import winsound
winsound.Beep(440, 200)
print exception_data
but I would much rather have some sort of shortcut. Is there, perhaps, some sort of plugin that does this, or is this really the best method?
I don't know of a plug-in that does that out of the box, but does not look like it would be hard to code. You only need to add a listener on the platform log and play the sound when an "error" is logged. Something like this should do the trick.
ILogListener listener = new ILogListener() {
public void logging(IStatus status, String plugin) {
if (status.getSeverity() == IStatus.ERRROR) {
// play beep sound
}
}
};
Platform.addLogListener(listener);
This needs to be done in an eclipse plugin, maybe even in its "start()" method since it does not need any more than that. This simple tutorial can tell you how to create a basic plugin.