[Pythonmac-SIG] Ahoy!

Dan Green dgreen@rewindtech.com
Mon, 14 Feb 2000 14:16:15 -0500


Hello, there.
	New to the list ... couldn't find an answer to this in the archives,
so here it is. I'm trying to write an event handler in python to replace one
written in AppleScript. Here's what I've got:

from MiniAEFrame import AEServer, MiniApplication

class EventHandler(AEServer, MiniApplication):
	def __init__(self):
		MiniApplication.__init__(self)
		AEServer.__init__(self)
		print "installing standard event handlers"
		self.installaehandler('aevt', 'oapp', self.open_app)
		self.installaehandler('aevt', 'quit', self.quit)
		self.installaehandler('ascr', 'psbr', self.retrospectEvent) 
		self.mainloop()
	
	def retrospectEvent(self, _object=None, _class=None, _type=None, **args):
		print _object, ":", _class, ":", _type
		for key in args.keys():
			print key + "==" + args[key]

	def open_app(self, **args):
		pass

	def quit(self, **args):
		self._quit()

if __name__ == '__main__':
		EventHandler()

But when an event actually gets sent from retrospect (the software I'm trying
to capture events from), I get one of these in the Python window:

AE error:  (-608, 'noOutstandingHLE')
in High Level Event: 'ascr' 'psbr'

So the event is being trapped and sent to the right application. Unfortunately,
my knowledge of Mac internals is not fantastic, so I'm at a loss here.

Any help would be appreciated.

Thanks!

--
Dan Green           |
Developer           | I used to be disgusted, now I find I'm just amused. 
Rewind Technologies |   -- Elvis Costello