2010-06-23 4 views
1

Salut à tous, je suis plutôt novice en python, alors fais-moi confiance.ImportError: Pas de module nommé Foundation

Je veux écrire un script simple en utilisant certains composants de PyObjC. Je cours sous Mac OS 10.5, donc d'après ce que j'ai lu, c'est inclus.

Toutefois, l'ouverture d'une invite python simple et en tapant import Foundation me donne l'erreur ImportError: No module named Foundation.

Pour référence, mon sys.path est

['', '/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', et '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/PyObjC', obtenu là-bas parce que je couchait, mais ils ne semblent pas me aider. La version 2.4 semble exister mais là, il semble n'y avoir aucun dossier avec le chemin mentionné ci-dessus dans la version 2.5.

Répondre

3

Je l'ai trouvé - pour une raison quelconque, il a été placé sous /System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python, donc je devais simplement ajouter ce répertoire tout à mon $PYTHONPATH

0

Où se trouve le module Foundation? En supposant que c'est au même endroit que PyObjC - /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ - alors vous devez ajouter /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ à votre $PYTHONPATH ainsi.

+0

C'est le problème - il n'y a pas PyObjC là - même si de tous la recherche que j'ai faite, PyObjC devrait être inclus avec Mac OS 10.5. – dmitrig01

Questions connexes