[Pythonmac-SIG] ascii <-> unicode <-> cocoa NSString

Keith Ray keith.ray at gmail.com
Mon Feb 20 22:05:33 CET 2006


PyFIT gives me ascii strings,and I am trying to call cocoa (and
eventually some applescript) functions from Python. I tried

from Foundation import NSString
from AppKit import NSWorkspace
import os.path

....etc...

        ws = NSWorkspace.sharedWorkspace()
        uapplicationpath = unicode(self.applicationpath, 'ascii')
        self.launchsuccess = ws.launchApplication_(
NSString.stringWithString_(uapplicationpath) )

but get a traceback:

 line 23, in result
    uapplicationpath = unicode(self.applicationpath, 'ascii')
TypeError: decoding Unicode is not supported

Help ?


More information about the Pythonmac-SIG mailing list