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.

3 Responses to “PyAverager tutorial error with Cocoa Bindings”

  1. kourge Says:

    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. Rasmus Tausen Says:

    Dear Kyle Crawford

    Where do I find a file named “main.py” – sorry I don’t get it…

  3. Kyle Crawford Says:

    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