I guess this is a FAQ, but I couldn't find an answer that fits my needs...
Normally you use unicode paths (with os.sep) with python. For appscript you need AppleScript file aliases (or how they're called). Additionally OSX' file system uses decomposed UTF-8, while most applications use composed UTF-8. Two different conversions that I struggle with all the time, and I'm very unhappy with my own "solutions". Up to Python 2.4 there was the macfile module (or was it part of appscript?) with its Alias object. Now it's gone. (Even if I don't know if it would fit my needs.) There's still the undocumented Carbon.File. (Would I use FSRef?) Or one could use PyObjC. (I'd like to avoid C syntax.) Or perhaps use the POSIX function from AS' StandardAdditions. (How do I call them with appscript?) And probably I overlooked some other possibilities. Please, are there any best practices to cope with OSX file paths? E.g.: I get a filename via sys.argv. It may contain international letters and spaces. It may even contain slashes if the volume was written with OS9. It might be a relative path. It's in the default encoding of the shell, or isn't it? * open that file - ok, should work without conversions. * open that file with some application via appscript -> convert the name to a valid "old style Mac path". (-> Absolute path, add volume name etc.) * write that filename into a file to be processed by e.g. TeX -> convert to composed UTF-8. * display that filename in some wxPython/dabo widget -> I still don't understand what encoding that needs, seems to differ by widget (label vs. tree view vs. status line). * other possibilities of output: print to stdout (encoding?), growl, database... Maybe I overlooked some basics of Python's Unicode handling, but my main problem at the moment are those Mac paths for appscript. Please help? Greetlings from Lake Constance! Hraban --- http://www.fiee.net https://www.cacert.org (I'm an assurer) _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig