Python Sound (“Bell”)

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

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.

I've also tried print(\a) but that didn't work.

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

Thanks!

Answers


Have you tried :

import sys
sys.stdout.write('\a')
sys.stdout.flush()

That works for me here on Mac OS 10.5

Actually, I think your original attempt works also with a little modification:

print('\a')

(You just need the single quotes around the character sequence).


Need Your Help

Passing a boost::bimap between functions

boost bimap

I'm new to the bimap functionality of the Boost libraries, and I'm having trouble passing a bimap into another function. My bimap looks like this:

Using jQuery, selecting the next <select> box and change its value

jquery ajax jquery-selectors css-selectors

Based on the title, I am able to do everything except select the correct box.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.