I am running the following code in Python 2.7 with pyAudio installed.
import speech_recognition as sr
r = sr.Recognizer()
with sr.Microphone() as source:
I have solved the same problem for me with the following (noise suppression), The "listen" function has problems with environment noise. So the running code is only blinking waiting.
Use this ambient noise suppression/adjustment;
r.adjust_for_ambient_noise(source, duration=5)
Referance Tuesday, March 28, 2017 Easy Speech Recognition in Python with PyAudio and Pocketsphinx