Photoshop + Python problem

So decided to try and apply what I learned in python thanks to Jason Parks awesome webinar and just wanted to try my hand at some photoshop scripting since right now doing some texture work. Anywho, following Adam’s blog post about COM and python and for some reason the code breaks at the open stage. Here’s the code:

import win32com.client  
psApp = win32com.client.Dispatch("Photoshop.Application") 
psApp.Open(r"C:	est.jpg")       
doc = psApp.Application.ActiveDocument  
layer = doc.ArtLayers[0]               
layer.AdjustBrightnessContrast(20,-15)   
doc.Save()  

pretty much a copy and paste and I get this as an error

Traceback (most recent call last):
File “C:\Users\Alistair Braz\workspace\Test est.py”, line 3, in <module>
psApp.Open(r"C: est.jpg")
File “C:\Python26\lib\site-packages\win32com\client\dynamic.py”, line 505, in getattr
ret = self.oleobj.Invoke(retEntry.dispid,0,invoke_type,1)
pywintypes.com_error: (-2147352567, ‘Exception occurred.’, (0, u’Adobe Photoshop’, u’Illegal argument - argument 1

  • Required value is missing’, None, 0, -2147220262), None)

Any ideas? I thought it was 2.7 been weird so moved to 2.6 and still nothing. Installed 2.6 pywin and getting same thing. Photoshop is 64bit and I installed the 64bit version of pywin too.

EDIT: Uninstalled and re-installed and nothing. Did some COM stuff with Word and worked. Gonna try and install Photoshop 32bit and see if anything happens.

Well that plan failed. Installed 32bit and nothing, same error. Stumped :frowning: Gonna try looking through the VBScript CS5 guide.

Just got this solved thanks to some help from polycount. It was User Access Control! Hopefully if anyone gets this problem, google will lead them here :slight_smile:

Yup. If you plan to do much COM work, do yourself a favor and turn UAC off. In fact, turn it off anyway.

thats what i ended up doing. Thanks Adam and hope I didnt bother you with the email.