Benches Uncategorized

2

Problem Running Cocoa/Python Programs

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Hi,

I've just started to try to code Cocoa applications with XCode and Interface Builder using PyObjC, however I have been getting a lot of import/naming errors. The most recent is "NameError: name 'AppHelper' not defined" when I try to use the decorator @AppHelper.endSheetMethod. I tried to remedy this with "from AppHelper import endSheetMethod", but it has an import error with AppHelper. The autocomplete when inputting the decorator still works, and I am not having problems with any of the other modules I am importing, mainly objc, Foundation, and AppKit, nor am I having problems with other -- albeit simpler -- decorators such as @IBAction.

I read that the problems with importing could be caused by the fact that I have MacPython 2.6 installed, as well as several other Python libraries (Numpy, SciPi, etc). Apparently installing anything other than the base installation (and sometimes other than just the Mac OS X provided Python version) can cause (but does not necessarily mandate) problems in Python.framework.

If anyone could provide some insight on this I would be grateful... Thanks!

2 replies

Sign in or join Beachball Help to reply.

  1. 0

    orangekay

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    If you want your code to work on anyone else's machine do not mess with the default Python installation.

  2. 0

    ericmeyers

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It's your MacPython installation. Why do you have it? I have Numpy, SciPy and Matplotlib running just fine with Apple's default Python (though I had to build Numpy from source).

    Eric