[Pyobjc-dev] PythonBrowser example/study + bug report
Brought to you by:
ronaldoussoren
From: Just v. R. <ju...@le...> - 2002-11-30 15:07:35
|
To finally really get starting and building a little Cocoa app myself, I tried to build a rudimentary Python Object browser. I've attached the code + nib etc, I'd be happy to check it into the Examples directory. Question: I needed to subclass NSObject and was a little confused that it doesn't by default behave more like a Python object. I wrote a __new__ method in my subclass that does this: def __new__(cls, *args, **kwargs): return cls.alloc().init() Now I can instantiate an NSObject subclass like I would instantiate an Python object: even the __init__() is now also called. Is there anything against adding some more Python flavor to the Python wrapper of NSObject? Hm, that's probably a very naive request, and might interfere with the Obj-C idiom. I'm I right that the above will only work when instantiation is done from Python, and not from Obj-C? Ok, forget about it, I'll just use the above in a superclass of my own somewhere until I understand more of the implications... Bug/Feature request: When an exception is raised in a method that is called by the objc runtime, only a very brief error is printed to Console.app. Can this be changed so it does PyErr_Print(), which prints a complete Python traceback? Oh, and _after_ the brief error is printed, the program usually crashes hard: 2002-11-30 15:31:22.990 python2.3[21902] An uncaught exception was raised 2002-11-30 15:31:22.991 python2.3[21902] No attribute allow 2002-11-30 15:31:22.992 python2.3[21902] *** Uncaught exception: <OC_PythonException> No attribute allow Nov 30 15:27:25 python last message repeated 13 times Nov 30 15:31:24 python crashdump: Crash report written to: /Users/just/Library/Logs/CrashReporter/python2.3.crash.log 2002-11-30 15:31:24.633 Console[20835] Exception raised during posting of notification. Ignored. exception: *** NSRunStorage, _NSBlockNumberForIndex(): index (36561) beyond array bounds (36561) This makes it quite painful to debug an app. Just |