[python-win32] Python COM and Photoshop
Sam The Cat
sam_spam_cat at verizon.net
Wed May 2 00:28:57 CEST 2007
Jim,
Yes -- Each permutation has the same issue -- If I try anything that
looks two dimensional I get the error below, if I try a scalar or single
dimension array I get an "illegal" argument error
----- Original Message -----
From: "Jim Vickroy" <Jim.Vickroy at noaa.gov>
To: "Sam The Cat" <sam_spam_cat at verizon.net>
Cc: <Python-win32 at python.org>
Sent: Tuesday, May 01, 2007 11:43 AM
Subject: Re: [python-win32] Python COM and Photoshop
> Sam The Cat wrote:
>> Help !
>>
>> I am writing some COM code in Python to control photoshop. Several
>> functions of PS require an "Array" argument. In the examples of
>> VBscript
>> or javascript the Array type is used. I have tried what would appear to
>> be
>> the equivalent in Python -- Lists and Tuples -- but to no avail. Anyone
>> have
>> any insight on what via the COM interface is equivalent to an Array in
>> javascript ?
>>
>> Here is the Javascript example code
>>
>> .....
>> selRegion = Array(Array(1,1),Array(1,2),Array(2,2),Array(2,1))
>> Doc.Selection.Select(selRegion,1,0,0)
>> .....
>>
>> Here is my interpretation in Python
>>
>> .......
>> selregion = [(1,1),(1,2),(2,2),(2,1)]
>> print selregion
>> doc.Selection.Select(selregion,1,0,0)
>> ......
>>
>> Here is the error code generated
>>
>> ..........
>> 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)
>>
>>
>> ............
>>
>> I have tried many differnet permutations of structure for the selregion
>> variable. Any scalar or single dimension array returns an "Illegal
>> Argument" response with no further details -- any thing that resembles a
>> two
>> dimensional array returns the result above.
>>
>
> I assume this means you have tried a list of lists as follows:
>
> selregion = [[1,1],[1,2],[2,2],[2,1]]
>
>
>> Any help / thoughts would be appreciated
>>
>>
>>
>> _______________________________________________
>> 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