-
-
Save rdapaz/63590adb94a46039ca4a10994dff9dbe to your computer and use it in GitHub Desktop.
| # If errors are found, do this | |
| # clear contents of C:\Users\<username>\AppData\Local\Temp\gen_py | |
| # that should fix it, to test it type | |
| import win32com.client | |
| app = win32com.client.gencache.EnsureDispatch('Word.Application') | |
| app.Visible = True |
Hi, in my case, sudenly, it happens again, i tried all metods showed here and no luck, in the end, i realized that my microsoft 365 apps for enterprise had beed updated few days ago in windows control panel, just right click, change, quick repair, and thats it, it worked again!!
regards
@amarines2605 - I've deleted gen_py countless times as everyone seems to recommend... the quickfix for microsoft 365 was the piece I was missing. Thank you for the solution.
Remove-Item -path $env:LOCALAPPDATA\Temp\gen_py -recurse
work for me!!!!!!!!!!!! ty!
From PowerShell one can use:
Remove-Item -path $env:LOCALAPPDATA\Temp\gen_py -recurse
Thank you Plus.
After deleting the content of C:\Users\AppData\Local\Temp\gen_py, you have to restart the computer. Then you can launch in Python or Spyder :
`import win32com.client as win32 from win32com.client import constants, Dispatch
excel = win32.gencache.EnsureDispatch ("Excel.Application") word = win32.gencache.EnsureDispatch("Word.Application") `
Just deleting the contents from
AppData\Local\temp\gen_py
worked for me
@HeroOfStorm When putting code, it's better to put between triple backsticks with an optional language, like:
This will:
__gen_path__being replaced by gen_path (with bold and without underscores)