Python RTD服务器不会更新

2024-09-27 20:16:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在运行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-0000000000 46}的Guid不同

我尝试过,但是在EnsureModule函数的前面出现了一个错误:

    tlb = pythoncom.LoadRegTypeLib(typelibCLSID, major, minor, lcid)

pywintypes.com_错误:(-2147319779,“库未注册”,无,无)

我看到有人操纵了这个调用的其他变量,但我甚至不知道它们是什么

我有64位Python和64位Excel

HKEY_LOCAL_MACHINE\software\classes\CLSID{00020830-0000-0000-C000-0000000000 46}的输出:

 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

Tags: comnonedefault错误thisexcelguidrtd

热门问题