0
Traceback (most recent call last):
  File "C:\Users\deepak.prasad\Desktop\python_scrapping\psd\app.py", line 18, in <module>
    ps.app.executeAction(replace_contents, desc)
  File "C:\Users\deepak.prasad\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\photoshop\api\application.py", line 354, in executeAction
    return self.app.executeAction(event_id, descriptor, display_dialogs)
  File "C:\Users\deepak.prasad\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\client\lazybind.py", line 182, in caller
    return self._comobj._invoke(descr.memid, descr.invkind, 0, *args)
  File "C:\Users\deepak.prasad\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\comtypes\automation.py", line 728, in _invoke
    self.__com_Invoke(memid, riid_null, lcid, invkind,
_ctypes.COMError: (-2147213497, None, (None, None, None, 0, None))

> Blockquote

我被上面的错误困住了,从任何地方都没有得到任何线索,我只是想使用 photoshop-api 来替换我的 psd 文件的图像。附上我的代码以供参考。

"""Replace the image of the current active layer with a new image."""


from photoshop import Session
import photoshop.api as ps


app = ps.Application()
print("ps.Application executed")
app.load("C:\\Users\\deepak.prasad\\Desktop\\python_scrapping\\psd\\Ad-format-final-1.psd")
print("template loaded successfully")

with Session() as ps:
    replace_contents = ps.app.stringIDToTypeID("logo")
    desc = ps.ActionDescriptor
    idnull = ps.app.charIDToTypeID("null")
    desc.putPath(idnull, "C:\\Users\\deepak.prasad\\Desktop\\python_scrapping\\psd\\logo1.png")
    ps.app.executeAction(replace_contents, desc)
4

0 回答 0