0

Say something!

Traceback (most recent call last):<br/>
  File "speechrecognition.py", line 17, in <module><br/>
    print("You said: " + r.recognize_google(audio))<br/>
  File "C:\python27\lib\site-packages\speech_recognition\__init__.py", line 828, in recognize_google<br/>
    convert_width=2  # audio samples must be 16-bit<br/>
  File "C:\python27\lib\site-packages\speech_recognition\__init__.py", line 448, in get_flac_data<br/>
    startup_info.dwFlags |= subprocess.STARTF_USESHOWWINDOW  # specify that the wShowWindow field of `startup_info` contains a value<br/>
AttributeError: 'module' object has no attribute 'STARTF_USESHOWWINDOW'<br/>
Moinuddin Quadri
  • 46,825
  • 13
  • 96
  • 126
Rahul sharma
  • 1,492
  • 12
  • 26
  • have you imported the `subprocess` module? – kingJulian Jan 06 '18 at 15:45
  • yes i have imported subprocess – Rahul sharma Jan 07 '18 at 07:54
  • this is my program import speech_recognition as sr r = sr.Recognizer() with sr.Microphone() as source: print("Say something!") audio = r.listen(source) try: print("You said: " + r.recognize_google(audio)) except sr.UnknownValueError: print("Google Speech Recognition could not understand audio") except sr.RequestError as e: print("Could not request results from Google Speech Recognition service; {0}".format(e)) – Rahul sharma Jan 07 '18 at 09:05
  • I'm sorry but your code is not readable, please format it accordingly. However from what I can see you have not imported the subprocess module, just the speech_recognition. – kingJulian Jan 07 '18 at 11:25
  • i have imported still i have error – Rahul sharma Jan 08 '18 at 13:59
  • You have imported speech_recognition. I'm talking about the subprocess module. – kingJulian Jan 08 '18 at 14:52
  • after import subprocess there is same error. what should i do? – Rahul sharma Jan 09 '18 at 09:12

1 Answers1

0

After a little bit of research it seems that in Python 2.7 version (the one you are using) you have to use subprocess._subprocess.STARTF_USESHOWWINDOW instead of subprocess.STARTF_USESHOWWINDOW. The latter was added after the 2.7 version.

kingJulian
  • 5,601
  • 5
  • 17
  • 30
  • problem solved by using bing api r.recognize_bing(audio, key=BING_KEY) it is better then google api and it works good in windows without any error – Rahul sharma Jan 10 '18 at 12:13