[Pythonmac-SIG] Clueless with CodeWarrior

Jack Jansen Jack.Jansen@cwi.nl
Fri, 9 Aug 2002 10:20:50 +0200


On Friday, August 9, 2002, at 12:33 , Robin Siebler wrote:

> I have the following script which works perfectly in the interactive 
> window.
>
> import CodeWarrior
> cw = CodeWarrior.CodeWarrior(start=1)
> cw.activate()
> cw.open (file1)
> cw.disassemble_file(file2)
>
> When I open the script in MacPython and run it, I get the follow 
> error(s):
>
> MacOS.Error: (-600, 'no eligible process with specified descriptor')
> File "simplec.py", line 4, in ?
> 	cw.activate()
> File "aetools.py", line 199, in activate
> 	self.send('misc', 'actv')
> File "aetools.py", line 191, in send
> 	return self.sendevent(self.newevent(code, subcode, parameters,
> attributes))
> File "aetools.py", line 185, in sendevent
> 	self.send_timeout

This happens to me once in every, uhm, 10 or so runs. I never bothered 
to debug it, as for my application simply restarting the application 
makes it work.

The problem is that the CodeWarrior.CodeWarrior(start=1) returns before 
CodeWarrior is actually ready to listen to AppleEvents. Either the 
application needs to be started in a different way, or after starting it 
we should go into a loop for, say, 5 seconds waiting for the application 
to actually have come up (we could ping it with te noop AppleEvent). If 
you fix this: please submit a patch to sourceforge!

> Can anyone tell me what the errors mean and how to fix them?  For future
> reference, is there a way to capture the contents of the traceback 
> window so
> I don't have to type everything?

After PythonInterpreter has exited you can't always copy from the 
console window anymore. The workaround is not to let PythonInterpreter 
exit: depress ALT while Python is starting, and select the "interactive 
mode after script" checkbox.
--
- 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 -