[Pythonmac-SIG] Re: Found my OSA problem !

Jack Jansen Jack.Jansen@oratrix.com
Thu, 24 Oct 2002 23:18:37 +0200


On donderdag, oktober 17, 2002, at 08:20 , Alexandre Parenteau wrote:

> Jack,
>
> I've been telling you over and over I had some AppleScript 
> problems, events
> not returning. For example I use Make_Project of CodeWarrior.
> Metrowerks_Shell_Suite.py, and it never returned an error when 
> the project
> was failing.

Alexandre,
I don't understand why your change would work. The login of 
aetools.unpackevent is as follows
def unpackevent():
	if there is a ---- direct object parameter:
		unpack it into parameters[----]
	while we've missed any other parameters:
		unpack these by name into parameters
	for all attributes we know about:
		if the attribute is present:
			unpack it into attributes

Your extra code (if there's no ---- direct object) handles a 
case that is already handled by the while loop just below....

Could you pack up a python script plus CodeWarrior 7.2 project 
that demonstrates your problem? Please state the problem exactly 
(i.e. Expected behaviour: xxxx Observed behaviour: xxxx).

>
> The solution came for me around the aetools.unpackevent:
>
>     try:
>         dirobj = ae.AEGetParamDesc('----', '****')
>     except AE.Error:
>         pass
>     else:
>         parameters['----'] = unpack(dirobj, formodulename)
>         del dirobj
>
> If I understand correctly, it is expected there is an event of 
> type '----'
> to return an error. Well, maybe it used to, but not anymore for me on
> Jaguar. Instead, I get directly the 'errn' event coming back. 
> So I changed
> the code this way :
>
>    try:
>         dirobj = ae.AEGetParamDesc('----', '****')
>     except AE.Error:
>         try:
>             keyword, dirobj = ae.AEGetNthDesc(1, '****')
>         except AE.Error:
>             pass
>         else:
>             parameters[keyword] = unpack(dirobj, formodulename)
>     else:
>         parameters['----'] = unpack(dirobj, formodulename)
>         del dirobj
>
> Note I don't like this code, may be I should use AECountItems.
>
> Anyway, that was the source of my problem. How come you don't 
> experience
> that ??? I don't understand ! Why the returned event suddenly 
> changed from
> '----' (and then 'errn' inside the AEList) to directly 'errn' ?
>
> Anyway, if it could make it for 2.2.2, I want to emphasize that without
> this, I don't have CodeWarrior.CodeWarrior functional (tested 
> on CW 7.1,
> 7.2, 8.0, 8.1, 8.2, Py2.2.1, Py2.3a0, re-generating 
> CodeWarrior.CodeWarrior
> or not).
>
> Alex.
>
> --
> Alexandre Parenteau
> Computer Scientist
> Core Technologies, AGM
> Adobe Systems, Inc.
> 408-536-6166
>
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- 
Emma Goldman -