I just got my RPi and it used to be able to play tones with winsound. Now, I get an error when I try to import it. Do I have to reimage?

File "/home/pi/Py_Progs/tones1.py", line 1, in import winsound ImportError: No module named 'winsound'

1 Answer 1


From https://docs.python.org/2/library/winsound.html :

35.4. winsound — Sound-playing interface for Windows

The Raspberry Pi is not a Windows computer, it is a Linux computer. You will need to use a different sound library to be able to play sounds from Python on the RPi.

These questions over on our sister site StackOverflow give some options:



The best recommendation I have been able to get from a quick search is to utilize the pygame module instead of winsound, like so (courtesy of the accepted answer in the second StackOverflow link above):

import pygame



  • When I first got the RPi it would play sounds with winsound. Now I get an error importing it. I can't get sounds from anywhere now. Even SonicPi doesn't work. I can import pygame but no noise when I run the script you provided. Must be something else like maybe even hardware. I'll keep fooling around. How much can I mess it up anyway? Thanks for answering.
    – hcappy
    Commented Jan 6, 2017 at 21:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.