Photoshop CC 2017 + Python

南楼画角 提交于 2019-12-13 08:18:00

问题


I have the exact same problem than the one described in this topic, with Photoshop CC 2017, python 2.7.13, comtypes 1.1.3, windows 7 (all 64-bits)
Trying to call a Photoshop method via python + comtypes raises a TypeError saying that the object is not callable:

from comtypes.client import CreateObject
psApp = CreateObject("Photoshop.Application.110") # edited to match photoshop CC 2017
#Create a new document- this is where it bombs out!
psApp.Documents.Add(1024, 1024, 72, 'new_source_texture', 2, 1, 1)

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

...accessing it as if it were a property actually invoke the method with default args:

psApp.Documents.Add  #without explicit call

Has anyone encountered or solved this issue?
thanks!

Paul

来源:https://stackoverflow.com/questions/45174628/photoshop-cc-2017-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!