[python-win32] Automating OneNote/COM without editing the registry

johnny at birchetts.com johnny at birchetts.com
Mon Mar 9 13:17:06 EDT 2020


I've successfully used pywin32 to automate some OneNote stuff using pywin32
directly and also using onepy, but I ALWAYS have to edit the registry to
"fix" the OneNote key  {0EA692EE-BB50-4E3C-AEF0-356D91732725} as described
in this stackflow answer:
https://stackoverflow.com/questions/16287432/python-pywin-onenote-com-onenot
e-application-15-cannot-automate-the-makepy-p 

On a fresh install of Windows 10 and Office 2019 + OneNote 2016, the
registry looks like the one in the stackoverflow question. 

>From time to time, I am on a machine where I don't have admin and I just
can't automate OneNote. Is this a limitation of win32/COM or a limitation of
pywin32? I seem to be able to use automation from powershell as a non-admin,
so I'm not understanding what the problem with makepy is. Also, I noticed
makepy does successfully generate a static proxy .py file, but when I try to
create a onenote object
with win32com.client.gencache.EnsureDispatch('OneNote.Application'), it
fails with the typical makepy error message "COM object can not automate the
makepy process". From what I can tell, powershell is creating a runtime
wrapper in a similar way as pywin32, so it seems like this should be
possible, but I don't have enough experience with python or COM to figure
this out. Google is no help because every answer says "edit the registry".
Is that the only answer?




More information about the python-win32 mailing list