AttributeError module object has no attribute listen

+1 vote

I have the following piece of code:

import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
    audio = sr.listen(source)

I get the following error:

   audio = sr.listen(source)
AttributeError: 'module' object has no attribute 'listen'
Oct 3, 2019 in Python by Hannah
• 18,570 points

edited Jun 25, 2020 by MD 6,037 views

go for 

audio= r.listen(source)

i went for this !!  but still not working

Hi, @Headhunterz.

What exactly are you trying to do? Could you please clarify a bit? And what error you are getting now? 

3 answers to this question.

+1 vote

You'll have to install the pyaudio module in python. Before you can use pyaudio, you need to install SpeechRecognition. Execute the following two commands to installing these two modules:

pip install SpeechRecognition
pip install pyaudio
answered Oct 3, 2019 by Liala
I've already installed the packages you mentioned above but am still facing that error 'speech_recognition' has no attribute listen
How can I handle this?
Hi @Jack, what is the name of your python file? Sometimes the file you are executing might be the name of a function and that throws an error.
if you or anyone solve this error in future please please tell me how to solve it at gajareashish40@gmail.com
Hey, @Ashish,

Are you getting the exact error which is mentioned above?
hey bro were you able to solve that error???
Hi,

Try the below-given solution. It will work.
0 votes
insted of  sr.listen() write r.listen()

as u r initalize the  Recognizer() it has the function of listen()
answered May 13, 2020 by anonymous
0 votes

Hi,

Listen attribute comes under the Recognizer method. So you need to call listen from the Recognizer method.

r = sr.Recognizer()
with sr.Microphone() as source:
    audio = r.listen(source)
answered Jun 25, 2020 by MD
• 95,440 points

Related Questions In Python

0 votes
1 answer

Getting AttributeError: 'module' object (scipy) has no attribute 'misc' in Python. How to solve this?

>>> import scipy >>> scipy.misc Traceback (most recent call ...READ MORE

answered Dec 24, 2018 in Python by Nymeria
• 3,560 points
8,892 views
0 votes
1 answer

AttributeError: 'module' object has no attribute 'HTTPSConnection'

Hi@akhtar, You have to install openssl and openssl-devel before ...READ MORE

answered Apr 20, 2020 in Python by MD
• 95,440 points
1,793 views
+1 vote
1 answer
0 votes
1 answer

Error:AttributeError: 'module' object has no attribute 'tests'

Hello @kartik, The problem was that test couldn't find ...READ MORE

answered Aug 7, 2020 in Python by Niroj
• 82,880 points
11,508 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,007 views
0 votes
1 answer
+5 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,790 points
3,386 views
0 votes
1 answer

Python error "AttributeError: '_Screen' object has no attribute 'mainloop'" python module turtle

Hey @Nagya, replace  wn.mainlopp() with turtle.mainloop() ...READ MORE

answered Jun 19, 2019 in Python by Faiza
6,421 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP