求助 pywintypes.com_error: (-2147221005, '无效的类字符串'... 问题 - V2EX
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
woshichuanqilz

求助 pywintypes.com_error: (-2147221005, '无效的类字符串'... 问题

  •  
  •   woshichuanqilz Jun 28, 2019 6797 views
    This topic created in 2511 days ago, the information mentioned may be changed or developed.
    1. https://github.com/nateshmbhat/pyttsx3/issues/32
    2. https://bbs.csdn.net/topics/392378574
    3. https://blog.csdn.net/bamuta/article/details/44460187
    4. https://segmentfault.com/q/1010000014342682
    5. https://www.cnblogs.com/jiangzhaowei/p/6815958.html 参考了这五个连接 python 32bit 64bit 都不行

    安装了 : Speech SDK 5.1

    pytts3 pywin32 安装了

    python 代码就是简单的一个 tts 调用, 应该是环境的问题。。。但是不知道怎么办了, speech sdk3 找不到下载

    # -*- coding: utf-8 -*- import pythoncom from win32com import client pythoncom.CoInitialize() engine=client.Dispatch("SAPI.SpVoice") engine.Speak('hello world') 

    报错如下:

     $ C:\Python36-32\python.exe test.py Traceback (most recent call last): File "C:\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 89, in _GetGoodDispatch IDispatch = pythoncom.connect(IDispatch) pywintypes.com_error: (-2147221005, '无效的类字符串', None, None) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "test.py", line 5, in <module> engine=client.Dispatch("SAPI.SpVoice") File "C:\Python36-32\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx) File "C:\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 114, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python36-32\lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) pywintypes.com_error: (-2147221005, '无效的类字符串', None, None) 
    5 replies    2019-06-28 15:33:55 +08:00
    geelaw
        1
    geelaw  
       Jun 28, 2019 via iPhone
    说明 SAPI.SpVoice 这个 ProgID 没有注册
    1462326016
        2
    1462326016  
       Jun 28, 2019
    亲测 Python3.6.7 32 位,网上下载了 dll 文件,然后注册了 dll,复制你的代码完美运行。
    没有安装你提供的那个 sdk,没有安装你的 pytts3,完美运行,你可以参考下,是不是你安装的版本什么的不对。
    woshichuanqilz
        3
    woshichuanqilz  
    OP
       Jun 28, 2019
    @1462326016 你下载的那个 dll?
    1462326016
        4
    1462326016  
       Jun 28, 2019
    @woshichuanqilz 我直接百度了一个,SAPI.SpVoice 以这个为关键字搜索的一个 zip 文件,然后注册了直接就可以调用了
    woshichuanqilz
        5
    woshichuanqilz  
    OP
       Jun 28, 2019
    @1462326016 谢谢了 大概率是我的系统是精简版被阉割了
    About     Help     Advertise     Blog     API     FAQ     Solana     3743 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 47ms UTC 04:33 PVG 12:33 LAX 21:33 JFK 00:33
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86