Why genguid.exe generated clsid won't work?

*爱你&永不变心* 提交于 2019-12-24 11:18:17

问题


I am trying to modify exceladdin.py example from pywin demos.

Otherwise I can modify it, but when I replace the clsid given in example:

"{C5482ECA-F559-45A0-B078-B2036E6F011A}"

With the one generated by genguid.exe or pythoncom.CreateGuid() e.g.:

"{E44EF798-7FDF-4015-AED6-00234CBBBA77}"

The com-addin stops working. No trace, no errors just the following text in excel com-objects list (translation) "Add-in not loaded. Error in runtime while loading com object."

Am I missing a step in generating clsid?

EDIT: I think I found the problem... clsid is the id of the dll. In the case of python, the clsid refers to pythoncomloader27.dll. Is this right? ...but still I can't load the correct python file. The clsid is somehow linked to pythoncomloader and the original pythonfile. If I generate a new clsid, I have to link it to pythonloader? How?


回答1:


Ok, I think that I found the answer...

python cannot be installed in "program files" folder unless you run everything as root (admin).

The python program that registers the com-service reads/writes <pythonInstallationDir>/Lib/win32com/gen-py directory. Word (or the program that uses the com service) has to be able to write(?) there as well. There exists non-human readable dictionary etc.

installing python to c:/python27 solved my problem. Now only the register program has to be run as root. Word can be run as normal user. I think in my case I messed up the dictionary by not giving enough privileges at the second time (first time I registered it correctly) and it was using the original keys.



来源:https://stackoverflow.com/questions/12184425/why-genguid-exe-generated-clsid-wont-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!