Re: 10.8, 10.9, NSDocument, TypeError, "cannot change a method"

Erik van Blokland <[email protected]> Sat, 31 Aug 2013 15:52:17 +0200
Newsgroups gmane.comp.python.pyobjc.devel
Message-ID <[email protected]>
Hi Ronald,
thanks for the clue. I think I've localised the problem.

On 29 aug. 2013, at 13:37, Ronald Oussoren <[email protected]> wrote:
> 
> This means that your document class problably has an attribute that has the same name as a method that is new in OSX 10.9.

This script shows the 10.9 NSView has a backgroundColor method.

from AppKit import NSView, NSColor
class MyView(NSView):
    def init(self):
        self = super(MyView, self).init()
        self.backgroundColor = NSColor.lightGrayColor()
        return self
    
print MyView.alloc().init()

On 10.8.4:
> <MyView: 0x7fe65620eaa0>

On 10.9 (13A558):
> Traceback (most recent call last):
>   File "/Volumes/erik/Desktop/test.py", line 10, in <module>
>     print MyView.alloc().init()
>   File "/Volumes/erik/Desktop/test.py", line 7, in init
>     self.backgroundColor = NSColor.lightGrayColor()
> TypeError: cannot change a method

Cheers,
Erik
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk