Reputation: 1
The Python shell is showing me this error
Traceback (most recent call last):
File "C:\Users\DELL\Desktop\winsound.py", line 1, in <module>
import winsound
File "C:\Users\DELL\Desktop\winsound.py", line 5, in <module>
winsound.beep(frequency,duration)
AttributeError: 'module' object has no attribute 'beep'
Code in winsound.py
import winsound
from random import randrange
frequency = randrange(5000)
duration = randrange (2000)
winsound.beep(frequency,duration)
Upvotes: 0
Views: 339
Reputation: 614
Below is the documentation of the winsound.Beep
winsound.Beep(frequency, duration)
Beep the PC’s speaker. The frequency parameter specifies frequency, in hertz, of the sound, and must be in the range 37 through 32,767. The duration parameter specifies the number of milliseconds the sound should last. If the system is not able to beep the speaker, RuntimeError is raised.
Try changing beep to Beep. it will solve your problem
Upvotes: 1