Getting TypeError with speech_recognition module in Python
Question: I want to convert speech to text in real time using the module
`SpeechRecognition 3.4.6` I've installed everything and now I am trying a
simple code from example, here's the code:

    
    
    import speech_recognition as sr
    
    # obtain audio from the microphone
    r = sr.Recognizer()
    with sr.Microphone() as source:
        print("Say something!")
        audio = r.listen(source)
    
    # recognize speech using Sphinx
    try:
        print("Sphinx thinks you said " + r.recognize_sphinx(audio))
    except sr.UnknownValueError:
         print("Sphinx could not understand audio")
    except sr.RequestError as e:
         print("Sphinx error; {0}".format(e)) 
    

I am getting error at line `audio = r.listen(source)`, the error traceback is:

    
    
    Traceback (most recent call last):
    File "sr.py", line 4, in <module>
    audio = r.listen(source)                   # listen for the first    phrase and extract it into audio data
     File "/usr/local/lib/python2.7/dist-  packages/speech_recognition/__init__.py", line 493, in listen
     buffer = source.stream.read(source.CHUNK)
     File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 139, in read
      return self.pyaudio_stream.read(size, exception_on_overflow = False)
      File "/usr/local/lib/python2.7/dist-packages/pyaudio.py", line 608, in read
     return pa.read_stream(self._stream, num_frames, exception_on_overflow)
     TypeError: function takes exactly 2 arguments (3 given)
    


Answer: You need to install pyaudio 0.2.9, it seems you have older version

