[python-win32] Fw: Python COM and Photoshop

Sam The Cat sam_spam_cat at verizon.net
Wed May 9 02:14:37 CEST 2007


 Mark,
    My apologies -- I tried to relay that I have tried both ways  -- "early
 and late dispatch"

 Here is the output after running the makepy routine on the type and object
 libraries for Photoshop

 ---------------------------------------------------------------------------
 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)]
 Traceback (most recent call last):
  File "F:\automation\test3.py", line 16, in <module>
    doc.Selection.Select([[1,1],[1,2],[2,1],[2,2]])
  File
 "C:\Python25\lib\site-packages\win32com\gen_py\E891EE9A-D0AE-4CB4-8871-F92C0109F18Ex0x9x0.py", line 2606, in Select    , Type, Feather, AntiAlias) pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'Adobe Photoshop', 'Illegal argument - argument 1\n- Only arrays with dimension 1 are supported', None, 0, -2147220262), None) ----------------------------------------------------------------------------- I really think that Python knows what to do and that I do not know how to tell Python to do it.  What I need to end up with is a an array of VARINTs where each VARINT is an array of length two.  Maybe I should ask -- if the PythonCOM interface knows this will it turn a list of lists (ex. [[1,1],[1,2],[2,1],[2,2]]) into what I need ? Cheers>>> > F:\automation>test2.py>>> > [(1, 1), (1, 2), (2, 2), (2, 1)]>>> > Traceback (most recent call last):>>> >   File "F:\automation\test2.py", line 19, in ?>>> >     doc.Selection.Select(selregion,1,0,0)>>> >   File "<COMObject
 <unknown>>", line 3, in Select>>> > pywintypes.com_error: (-2147352567, 'Exception occurred.',>>> (0, 'Adobe>>> > Photoshop', 'Illegal argument - argument 1\n- Only arrays>>> > with dimension 1>>> > are supported', None, 0, -2147220262), None)>>>>>From the line:>>>>> >   File "<COMObject <unknown>>", line 3, in Select>>>> It appears you are not using 'makepy' for the object (maybe as makepy isnot>> support for that object).  If possible, you should try and use a makepy>> based object.  The easiest way is something like:>>>> from win32com.client.gencache import EnsureDispatch>> select = EnsureDispatch(select) # try and convert into makepy basedobject.>>>> If you can get that to work, you might have more luck, as python can>> determine the exact type of the variant from the type-library.>>>> Good luck,>>>> Mark>>>> _______________________________________________>> Python-win32 mailing list>> Python-win32 at python.org>> http://mail.python.org/mailman/listinfo/python-win32>>>>>



More information about the Python-win32 mailing list