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

Ronald Oussoren ronaldoussoren at mac.com
Mon Feb 20 22:28:33 CET 2006


On 20-feb-2006, at 22:05, Keith Ray wrote:

> 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

What is self.applicationpath? The error seems to indicate that it  
already is a unicode string.

Ronald

>
> Help ?
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list