[Pythonmac-SIG] problem trying to use aemreceive with Tkinter app

Kennedy, Andrew (GE Healthcare) Andrew.J.Kennedy at ge.com
Thu Dec 1 21:45:10 CET 2005

Hi folks,

I'm trying to use aemreceive to process AppleEvents in a Tkinter-GUI'd Python app.  I have been able to use argvemulator.py from plat-mac to handle double clicking on a file and having it open in the application automatically.  I'm now trying to catch 'ocon' and 'odoc' AppleEvents within the application to handle dragging files onto the icon and double clicking on files while the application is running.

I can add the event handler per the code below:

    if sys.platform == 'darwin':
        import aemreceive
        aemreceive.installeventhandler(AEOpenFile, 'aevtodoc',
                                       ('----','AliasList', aemreceive.ArgListOf(aemreceive.kAE.typeAlias)))

What am I missing?  Do I need to modify my main loop to handle the events?  I never seem to get into the event handler code this way, so there must be something else at work here.  Is my event handler at the wrong level of the stack?

The crash log is included after my signature.  Any assistance anyone can offer would be greatly appreciated.

Thanks in advance,

Andrew Kennedy
Applications Developer
Preclinical Imaging
GE Healthcare

P  +1 519 474 5190
F  +1 519 472 9492
E  Andrew.Kennedy at med.ge.com

Exception:  EXC_BAD_ACCESS (0x0001)
Codes:      KERN_PROTECTION_FAILURE (0x0002) at 0x00000008

Thread 0 Crashed:
0   org.python.python    	0x10022408 PyFrame_New + 0x20 (frameobject.c:540)
1   org.python.python    	0x100734a8 PyEval_EvalCodeEx + 0x88 (ceval.c:2456)
2   org.python.python    	0x10024e74 function_call + 0x158 (funcobject.c:504)
3   org.python.python    	0x1000c134 PyObject_Call + 0x30 (abstract.c:1756)
4   org.python.python    	0x10074ca4 PyEval_CallObjectWithKeywords + 0x100 (ceval.c:3347)
5   _AE.so               	0x0f2e9a30 GenericEventHandler + 0x154 (_AEmodule.c:1587)
6   com.apple.AE         	0x98fa8a10 aeDispatchAppleEvent(AEDesc const*, AEDesc*, unsigned long, unsigned char*) + 0xd0
7   com.apple.AE         	0x98fab858 dispatchEventAndSendReply(AEDesc const*, AEDesc*) + 0x2c
8   com.apple.AE         	0x98fa8c50 aeProcessAppleEvent + 0x11c
9   com.apple.HIToolbox  	0x92975224 AEProcessAppleEvent + 0x3c
10  com.tcltk.tklibrary  	0x0b07dcac TkMacOSXDoHLEvent + 0x10
11  com.tcltk.tklibrary  	0x0b07bb3c TkMacOSXProcessAppleEvent + 0x3c
12  com.tcltk.tklibrary  	0x0b07bc80 TkMacOSXProcessEvent + 0xb0
13  com.tcltk.tklibrary  	0x0b07bd14 ReceiveAndProcessEvent + 0x74
14  com.tcltk.tklibrary  	0x0b07bad8 TkMacOSXCountAndProcessMacEvents + 0x30
15  com.tcltk.tklibrary  	0x0b0870c0 TkMacOSXWaitForEvent + 0x250
16  com.tcltk.tcllibrary 	0x0a078370 Tcl_WaitForEvent + 0x64
17  com.tcltk.tcllibrary 	0x0a0565f8 Tcl_DoOneEvent + 0x128
18  _tkinter.so          	0x002872c0 Tkapp_MainLoop + 0x150 (_tkinter.c:2530)
19  org.python.python    	0x10074e18 call_function + 0x130 (ceval.c:3440)
20  org.python.python    	0x10072a54 eval_frame + 0x2568 (ceval.c:2116)
21  org.python.python    	0x10073d04 PyEval_EvalCodeEx + 0x8e4 (ceval.c:2663)
22  org.python.python    	0x100750f8 fast_function + 0x164 (ceval.c:3533)
23  org.python.python    	0x10074ef0 call_function + 0x208 (ceval.c:3458)
24  org.python.python    	0x10072a54 eval_frame + 0x2568 (ceval.c:2116)
25  org.python.python    	0x10075068 fast_function + 0xd4 (ceval.c:3520)
26  org.python.python    	0x10074ef0 call_function + 0x208 (ceval.c:3458)
27  org.python.python    	0x10072a54 eval_frame + 0x2568 (ceval.c:2116)
28  org.python.python    	0x10073d04 PyEval_EvalCodeEx + 0x8e4 (ceval.c:2663)
29  org.python.python    	0x10076b64 PyEval_EvalCode + 0x30 (ceval.c:537)
30  org.python.python    	0x100a8258 run_node + 0x4c (pythonrun.c:1265)
31  org.python.python    	0x100a7a2c PyRun_SimpleFileExFlags + 0x250 (pythonrun.c:865)
32  org.python.python    	0x100b41e0 Py_Main + 0x858 (main.c:415)
33  MicroView            	0x00001b10 0x1000 + 0xb10
34  dyld                 	0x8fe1a278 _dyld_start + 0x64

Thread 1:
0   libSystem.B.dylib    	0x9494746c select + 0xc
1   com.tcltk.tklibrary  	0x0b087290 NotifierThreadProc + 0x1b0
2   libSystem.B.dylib    	0x94960990 _pthread_body + 0x28

PPC Thread State:
  srr0: 0x10022408 srr1: 0x0200f030                vrsave: 0x00000000
    cr: 0x42822228  xer: 0x20000004   lr: 0x100734a8  ctr: 0x100223e8
    r0: 0x100734a8   r1: 0xbfffe770   r2: 0x10024e74   r3: 0x00000000
    r4: 0x0f4b90a0   r5: 0x0f4ae4b0   r6: 0x00000000   r7: 0x00000002
    r8: 0x42822228   r9: 0x100734a8  r10: 0x00000000  r11: 0x1010eda0
   r12: 0x100223e8  r13: 0x00000000  r14: 0x00000000  r15: 0x0f302ec4
   r16: 0x00000000  r17: 0x00000000  r18: 0x00000000  r19: 0x0028717c
   r20: 0x00000000  r21: 0x00000000  r22: 0x00000002  r23: 0x00000000
   r24: 0x00000000  r25: 0x0f4b90a0  r26: 0x00000000  r27: 0x00000000
   r28: 0x11aeb62c  r29: 0x0f4b90a0  r30: 0x00000000  r31: 0x10073428

More information about the Pythonmac-SIG mailing list