如何使用Python打开Photoshop并在已经创建的PSD文件模板中添加用户输入数据?

如何使用Python打开Photoshop并在已经创建的PSD文件模板中添加用户输入数据?,python,python-3.x,csv,photoshop-script,Python,Python 3.x,Csv,Photoshop Script,当我尝试使用python打开photoshop时,我遇到了一个错误。有人能帮我吗?我制作了一个应用程序,使用Tkinter获取用户数据,然后将数据附加到CSV文件中。我还希望它使用我在photoshop上创建的模板生成一幅包含这些数据的图像。但由于某些原因,我的程序正确打开photoshop,但也会生成错误消息: Traceback (most recent call last): File "d:\Coding\Python Scripts\Dr Nikhil Prescripti

当我尝试使用python打开photoshop时,我遇到了一个错误。有人能帮我吗?我制作了一个应用程序,使用Tkinter获取用户数据,然后将数据附加到CSV文件中。我还希望它使用我在photoshop上创建的模板生成一幅包含这些数据的图像。但由于某些原因,我的程序正确打开photoshop,但也会生成错误消息:

Traceback (most recent call last):
 File "d:\Coding\Python Scripts\Dr Nikhil Prescription App\PS_test.py", line 3, in <module>
   psApp.Open("Presc_Template.psd")
 File "<COMObject Photoshop.Application>", line 2, in Open
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop', 'Illegal argument - argument 
1\n- Expected a reference to an existing File/Folder', None, 0, -2147220262), None)

我应该做些什么来克服这个问题,以便我能够克服每次尝试使用Python打开Photoshop时不断出现的错误?我的目的是自动将CSV文件中的数据添加到Photoshop模板中,然后在用户每次需要时进行渲染。请帮帮我。谢谢大家!

您可以使用开源软件,它的设计正是基于这种输入->脚本->结果的工作流程。谢谢您的回复,但问题已经解决了!请
import win32com.client, os
psApp = win32com.client.Dispatch("Photoshop.Application")
psApp.Open("D:\Coding\Python Scripts\Dr Nikhil Prescription App\Prescription Generator\Presc_Template.psd")
doc = psApp.Application.ActiveDocument
layer_facts = doc.ArtLayers["Layer"] #Opening the specific layer
text_of_layer = layer_facts.TextItem
text_of_layer.contents = "This is a test." #Making changes to the text in the layer