Q:

Python comtypes - '_Dispatch' object is not callable

I have been using the comtypes module for Python to automate Photoshop, but I am getting a TypeError when I try to execute commands on windows8.
These same commands have been working fine on windows7.
This an example of the code I am using:
from comtypes.client import CreateObject

psApp = CreateObject("Photoshop.Application")

#Create a new document- this is where it bombs out!
psApp.Documents.Add(1024, 1024, 72, 'new_source_texture', 2, 1, 1)

And this is the Traceback I get:
Traceback (most recent call last):
    File "test.py", line 9, in <module>
    psApp.Documents.Add(1024, 1024, 72, 'new_source_texture', 2, 1, 1)
TypeError: '_Dispatch' object is not callable

I suspect it has something to do with comtypes returning the wrong type of object, but I'm pretty newb so if anyone can point me in the right direction I would really appreciate it! 
Thanks!

A:

It seems this is a compatibility issue with Windows 8. Once I set the Python command line to execute with windows XP compatibility mode the comtypes module worked as expected. 
This same fix also applies to the win32com module, which I tried but experienced similar difficulties with. 
To set compatibility modes in windows 8, you can follow these steps:

Go to your control panel.
Click on the 'Programs' category. 
Click on 'Run programs made for previous versions of windows'
Step through the troubleshooter, selecting the Python command line as the target program.  

