PyAverager tutorial error with Cocoa Bindings

this class is not key value coding-compliant for the key numbersInput

If you are getting this error after doing the PyObjC averager tutorial called Using PyObjC for Developing Cocoa Applications with Python , import your class in main.py.

After the line:
import PyAveragerAppDelegate

add:
import Averager

This should allow the numbersInput variable to be properly bound to Interface Builder.

I found the solution on macosxhints forum here.

Advertisements

3 thoughts on “PyAverager tutorial error with Cocoa Bindings

  1. This is a real lifesaver. I was worried when I found Tiger references in the tutorial (because that indicates the tutorial is quite outdated) given that I’m on Leopard, even though Leopard ships with PyObjC by default.
    Everything seemed fine until it seems that binding doesn’t work in IB. After wondering what could have gone wrong for a whole day, I then found this post.
    This really is the same kind of idiocracy in the RubyCocoa tutorial, where it told the reader to add a Custom View (barebone NSView) in IB, then set its identity to IKImageBrowserView, when in fact the IKImageBrowserView is available in the Library panel. Even after this, it told the reader not to worry because even though IKImageBrowserView belongs to Quartz.framework and its not added to the project, AppKit.framework is dependent on Quartz.framework. Which was wrong again, because it would throw an NSInvalidUnarchiveOperationException, saying that it “cannot decode object of class”. So the solution was to manually add Quartz.framework to the project.

  2. It is in the same folder as PyAverager.xcodeproj. It is part of the project and shows in the Groups & Files section when you have it open in Xcode.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s