Python Sound ("Bell")
<p>I'd like to have a python program alert me when it has completed its task by making a beep noise.  Currently,  I use <code>import os</code> and then use a command line speech program to say "Process complete."  I much rather it be a simple "bell."</p>

<p>I know that there's a function that can be used in Cocoa apps, NSBeep, but I don't think that has much anything to do with this.</p>

<p>I've also tried <code>print(\a)</code> but that didn't work.</p>

<p>I'm using a Mac, if you couldn't tell by my Cocoa comment, so that may help.</p>

<p>Thanks!</p>

<p>Have you tried :</p>

<pre><code>import sys
sys.stdout.write('\a')
sys.stdout.flush()
</code></pre>

<p>That works for me here on Mac OS 10.5</p>

<p>Actually, I think your original attempt works also with a little modification:</p>

<pre><code>print('\a')
</code></pre>

<p>(You just need the single quotes around the character sequence).</p>
