The reason that it does not give a sound signal is because \a (or ^G ) is the terminal bell code; it is up to stdout software to turn it into sound. Terminal.app will play the sound (unless you set it to "visual call", but turn it off completely), but Idle will not. And of course, if you run without tty, you wonβt get anything.
If you don't mind using PyObjC (which is pre-installed with Apple Pythons installed in all recent versions of OS X):
import Cocoa Cocoa.NSBeep()
Of course, this sounds like an OS X system signal, not a terminal call. Also, maybe this is a different sound, which means that if you turn off the call in the terminal, your script will still sound. (If you really want to use Terminal Terminal, you can always use script Terminal through, for example, ScriptingBridge. But I donβt think you care.)
source share