Это код Python:
#!/usr/bin/python
import os
import sys
from Foundation import *
from AppKit import *
import objc
def setupWindowMenu(app):
windowMenu = NSMenu.alloc().initWithTitle_('Window')
windowMenu.retain()
menuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Minimize', 'performMiniaturize:', 'm')
windowMenu.addItem_(menuItem)
windowMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Window', None, '')
windowMenuItem.setSubmenu_(windowMenu)
app.mainMenu().addItem_(windowMenuItem)
app.setWindowsMenu_(windowMenu)
app = NSApplication.sharedApplication()
mainMenu = NSMenu.alloc().init()
app.setMainMenu_(mainMenu)
setupWindowMenu(app)
app.finishLaunching()
app.updateWindows()
app.activateIgnoringOtherApps_(True)
app.run()
Я получаю этот вывод:
$ python pyobjcdemo.py
2011-09-11 23:22:40.470 Python[21409:1507] _createMenuRef called with existing principal MenuRef already associated with menu
2011-09-11 23:22:40.471 Python[21409:1507] (
0 CoreFoundation 0x00007fff93acb986 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff8f3b4d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff93acb7ba +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff93acb744 +[NSException raise:format:] + 116
4 AppKit 0x00007fff8a8841fb -[NSCarbonMenuImpl _createMenuRef] + 64
5 AppKit 0x00007fff8a883ae6 -[NSCarbonMenuImpl _instantiateCarbonMenu] + 148
6 AppKit 0x00007fff8a8588e9 -[NSApplication finishLaunching] + 878
7 AppKit 0x00007fff8a85827d -[NSApplication run] + 118
8 libffi.dylib 0x00007fff8cf29e7c ffi_call_unix64 + 76
9 ??? 0x00007fbd1b480d10 0x0 + 140450183253264
)
Почему?
Что это значит?
Почему этот простой код PyObjC имеет какие-либо углеродные зависимости?