[Tutor] Python Question

Steve Willoughby steve at alchemy.com
Wed Jan 9 09:05:22 CET 2013


On 2013-1月-7, at 下午3:31, Dylan Kaufman wrote:

> Greetings,
> 
> I take Computer Science in school and for a Python program, I have:
> 
> from winsound import Beep
> 

The first thing I notice is "from winsound import …"  Could that be a WINDOWS library which might not work on a Macintosh?

> Beep(196, 1500)#G
> Beep(262, 270)#C
> Beep(196, 200)#G
> 
> Traceback (most recent call last):
>   File "/Volumes/PICKLES/School/MyClass/Comp. Sci/Chapter 02 Stuff/program2_cep.py", line 5, in <module>
>     from winsound import Beep
> ImportError: No module named 'winsound'
> 

Looking at this, /Volumes/PICKLES/School/... that looks like a Mac filesystem mount point name to me.  Looks like you're using something that works on Windows at school, then trying to use it on a non-Windows system at home.

Try looking for a sound library which works on all platforms.  Failing that, look for something that works on a mac.

As a side note, you probably want to replace all those Beep() calls with some code which reads in a set of note values as data.


More information about the Tutor mailing list