Python, COM and windows 8

Recently I got myself a new laptop which came pre-installed with windows 8. Rather than instantly wiping it out and installing windows 7, I decided to give it a try.

After getting over the initial shock, I installed all my usual python tools and started setting up my scripts... only to suddenly be stopped dead in my tracks when all my comtypes related scripts no longer worked, coming up with something along the lines of:

                 TypeError: '_Dispatch' object is not callable

Lame! Anyway, if anyone else encounters this, the solution turned out to be running the Python command line in XP compatibility mode.

To set this up in windows 8, you can follow these steps:

  1. Go to your control panel.
  2. Click on the 'Programs' category. 
  3. Click on 'Run programs made for previous versions of windows'
  4. Step through the troubleshooter, selecting your Python command line as the target program. 
And it should all work again!