tags:

views:

38

answers:

2

Hey all, I'm pretty new to python, so bear with me.

I want to write a simple script using some components of PyObjC. I'm running on Mac OS 10.5, so from what I've read, it's included.

However, opening up a simple python prompt and typing import Foundation gives me the error ImportError: No module named Foundation.

For reference, my sys.path is

['', '/var/hg/lib/python2.4/site-packages', '/Users/dmitri/lib/python', 
'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyObjC', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyObjC', 
'/Users/dmitri', '/Library/Frameworks/Python.framework/Versions/2.5/lib/python25.zip', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-darwin', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/plat-mac/lib-scriptpackages', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-tk', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/lib-dynload', 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages']

'/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/PyObjC', and '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyObjC', got in there because I was fooling around, but they don't seem to help me. The 2.4 version seems to exists but there, seems to be no folder with the aforementioned path in the 2.5 version.

A: 

Where is the module Foundation located? Assuming it's in the same place as PyObjC -- /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ -- then you have to add /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ to your $PYTHONPATH as well.

mipadi
That is the problem though - there is no PyObjC in there - even though from all the research I've done, PyObjC should be included with Mac OS 10.5.
dmitrig01
A: 

I found it - for some reason, it was located under /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python, so I had to just add that whole directory to my $PYTHONPATH

dmitrig01