Foundation is a Obj-C framework, you'll need PyObjC to get that. If you use Leopard, it's pre-installed in the system python. A quick check is this:

>>>import objc

If this works, 'import Foundation' should work.

I've no idea how to install PyObjC on Tiger, unfortunately.

Orestis
--
ores...@orestis.gr
http://orestis.gr/




On 12 Feb 2009, at 21:30, O Flores wrote:

Hi there,

I am trying to run an script I found in 
http://codelemur.wordpress.com/2007/11/07/controlling-itunes-with-python-cross-platform/

The problem is that I get an error importing Foundation. Where is Foundation located and how can I include in the search path? Do I need to upgrade AppleScript? My Mac runs OS X.

Thanks for the help.

Omar



# -*- coding: utf-8 -*-
import sys
from optparse import OptionParser

platform = sys.platform
print platform
if platform == "win32":
    import win32com.client
iTunes = win32com.client.gencache.EnsureDispatch("iTunes.Application")

if platform == "darwin":
    from Foundation import *
    from ScriptingBridge import *
iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")

def previousTrack():
    if platform == "win32":
            iTunes.PreviousTrack()
    if platform == "darwin":
            iTunes.previousTrack()

...
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to