Python / ADOX:“找不到指定的模块。” (win32 扩展)
我正在为 python 2.5 运行 pywin32。
我正在按照 http://www.ecp.cc/pyado.html 给出的 python ADO 说明进行操作。
创建 ADODB.Recordset 对象效果很好。 但是,当我尝试创建 ADOX.Catalog 对象时,出现错误:
>>> cat=win32com.client.Dispatch(r'ADOX.Catalog')
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147024770, 'The specified module could not be found.', None, None)
有什么想法我可能会丢失吗?
I'm running pywin32 for python 2.5.
I'm following the instructions for python ADO given at http://www.ecp.cc/pyado.html.
Creating an ADODB.Recordset object works fine. But when I try to create an ADOX.Catalog object I get an error:
>>> cat=win32com.client.Dispatch(r'ADOX.Catalog')
Traceback (most recent call last):
File "<interactive input>", line 1, in <module>
File "C:\Python25\lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch
dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userName,clsctx)
File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 98, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 78, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch)
com_error: (-2147024770, 'The specified module could not be found.', None, None)
Any ideas what I might be missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方案:尽管 ADOX 作为可用库显示在 COM 浏览器中,但它并未正确“注册”。 按照此处的说明,我在“开始”->“运行”提示符处执行以下命令:
请注意,这是在 WinXP SP2 计算机上。 我猜注册表已经损坏了? 无论如何,我是 Windows 编程新手,所以我的解释可能不正确,但也许修复会对某人有所帮助。
Solution: even though ADOX was showing up in the COM browser as an available library, it wasn't "registered" properly. Following the instructions here, I executed the following at the Start->Run prompt:
Note that this is on a WinXP SP2 machine. I guess the registry had become corrupt somehow? In any case, I'm new to Windows programming so my explanation may be off, but maybe the fix will help someone.