0

I am developing an app in Django.

My app plays a sound using winsound module.

import sys
import winsound

duration = 150  # milliseconds
    freq = 440  # Hz
    winsound.Beep(freq, duration)
    winsound.Beep(freq, duration)
    winsound.Beep(freq, duration)

It worked fine as soon as I was developing in local, but when I pushed the app to heroku and then tryed to access the admin section, the web returned the error

ModuleNotFoundError at /admin

No module named 'winsound'

So I tryed to pip install windsound , but apparently there is no module having such name available for download.

Thinking that the module was maybe already installed but with another name, I also tried

pip freeze>requirements.txt

and added 'winsound' in INSTALLED_APPS, but nothing worked.

On the web I can find little information on winsound module and it appears it is not available to pip install with python... Does anybody knows how to solve it?

Tms91
  • 3,456
  • 6
  • 40
  • 74
  • Did you try `pip3 install windsound`? – Pedram Parsian Nov 26 '19 at 09:44
  • Yes, as for pip install winsound, it returns "ERROR: Could not find a version that satisfies the requirement winsound (from versions: none) ERROR: No matching distribution found for winsound". Also note that the name of the module is "winsound" and not "winDsound". – Tms91 Nov 26 '19 at 09:45
  • 2
    The **actual** problem is that `winsound` is for Windows, and heroku is linux-based. – Pedram Parsian Nov 26 '19 at 09:47
  • Thanks. I just got to it myself. write it as answer and I will flag as correct. – Tms91 Nov 26 '19 at 09:48
  • 2
    And what would be the point of playing a beep on Heroku anyway? Even if it worked, the beep would happen in Heroku's data centre somewhere, not on your machine. – Daniel Roseman Nov 26 '19 at 09:51
  • Thanks Daniel. So how do I tell Django to play the sound in my user device? – Tms91 Nov 26 '19 at 09:57

1 Answers1

4

The problem is that the operating system of heroku is linux, and winsound is only for Windows; So it won't be installed on heroku.

Pedram Parsian
  • 3,750
  • 3
  • 19
  • 34