0

I am new to Python. I am running Mac OS X 10.8.2, Python 2.7.3, Xcode 4.5.1. I am not able to import pyobjc to python.I used easy_install pyobjc or manually downloading it from http://pypi.python.org/pypi/pyobjc/2.3 and running python setup.py install. Here is a screenshot of my site-packages folder enter image description here

How do I solve this?

Here is a screenshot of sys.path.PyOBJc is present in sys.path

VeilEclipse
  • 2,766
  • 9
  • 35
  • 53
  • Are you literally using `import pyobjc`? Looking at the samples, on the sourceforge site, it appears that you're supposed to call `import objc` or `import py2app`, or `from PyObjCTools import AppHelper`, etc. Take a look at the samples. – David Oct 12 '12 at 18:14
  • `import objc` all say module not present – VeilEclipse Oct 12 '12 at 18:58

2 Answers2

2

I don't see a .pth file for pyobjc in your site-packages directory there.

.pth files, placed inside a directory already on Python's search path, contain directories to add to that search path. They're simple text files; you can review the ones already there to get a feel for how they work.

As to why you didn't get .pth files for pyobjc, I'm not sure. But you could create some to fix the problem up.

Further reading: Modifying Python’s Search Path

Mattie
  • 20,280
  • 7
  • 36
  • 54
1

The module name for PyObjC is not "pyobjc".

To use the low-level bridge use "import objc"

To access the Cocoa framework use "import Cocoa".

If "import objc" gives an import error you probably have a number of Python interpreters, check if the value of "sys.prefix" is what you expect it to be. Also check if "/Library/Frameworks/Python.framework/Version/2.7/lib/python2.7/site-packages" is on "sys.path".

Ronald Oussoren
  • 2,715
  • 20
  • 29