如何解决Python RTD 服务器不会更新
我正在运行 RTD 服务器的 this example。
我在 excel 中拨打电话:
=RTD("Python.RTD.TimeServer","","seconds","5")
第一次调用有效,但不再更新。
有一个错误:
pywintypes.com_error: (-2147221008,'CoInitialize has not been called.',None,None)
调用excel回调时发生:
self.__callback.UpdateNotify()
我不是该主题的专家,所以我的假设主要是猜测。
我发现的一件事是,一开始当你定义 Excel 类型库时:
EXCEL_TLB_GUID = '{00020813-0000-0000-C000-000000000046}'
EXCEL_TLB_LCID = 0
EXCEL_TLB_MAJOR = 1
EXCEL_TLB_MINOR = 4
# Import the excel typelib to make sure we've got early-binding going on.
# The "ByRef" parameters we use later won't work without this.
gencache.EnsureModule(EXCEL_TLB_GUID,EXCEL_TLB_LCID,\
EXCEL_TLB_MAJOR,EXCEL_TLB_MINOR)
Guid 与我的 excel 应用程序不同,即 {00024500-0000-0000-C000-000000000046}。
我已经尝试过了,但是我在之前的 EnsureModule 函数中遇到了一个错误:
tlb = pythoncom.LoadRegTypeLib(typelibCLSID,major,minor,lcid)
pywintypes.com_error: (-2147319779,'库未注册。',None)
我看到有人为这个调用操作了其他变量,但我什至不知道它们是什么。
我有 64 位 Python 和 64 位 Excel。
来自 HKEY_LOCAL_MACHINE\software\classes\CLSID{00020830-0000-0000-C000-000000000046} 的输出:
Hive: HKEY_LOCAL_MACHINE\software\classes\CLSID\{00020830-0000-0000-C000-000000000046}
Name Property
---- --------
AuxUserType
Conversion
DataFormats
DefaultExtension (default) : .xlsx,Excel Workbook (*.xlsx)
DefaultIcon (default) : C:\Program Files\Microsoft
Office\Root\VFS\Windows\Installer\{90160000-000F-0000-1000-0000000FF1CE}\xlicons.exe,1
DocObject (default) : 16
Implemented Categories
InprocHandler32 (default) : ole32.dll
Insertable (default) :
LocalServer32 (default) : C:\Program Files\Microsoft Office\Root\Office16\EXCEL.EXE
MiscStatus (default) : 0
ProgID (default) : Excel.Sheet.12
TypeLib (default) : {00020813-0000-0000-C000-000000000046}
Verb
Version (default) : 1.6
VersionIndependentProgID (default) : Excel.Sheet
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。