AttributeError:'模块'对象没有属性' STARTF_USESHOWWINDOW'

时间:2018-01-06 14:13:00

标签: python windows python-2.7 speech-recognition google-speech-api

说点什么!

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/>

1 个答案:

答案 0 :(得分:0)

research之后,似乎在Python 2.7版本(您正在使用的版本)中,您必须use subprocess._subprocess.STARTF_USESHOWWINDOW而不是subprocess.STARTF_USESHOWWINDOW。后者是在2.7版本之后添加的。