1
votes

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

1 Answers

0
votes

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.