[Pythonmac-SIG] Creator, type and other means of file detection

2008-11-29 Thread Henning Hraban Ramm
I know the MacOS module is deprecated, and now I know at least one detail of "why": If I use MacOS.GetCreatorAndType(filename) on my Intel machine, I get for an EPS: ('09HF', 'FSPE') That should read ('FH09', 'EPSF'). I didn't knew endian-ness affects the order of strings. Very funny! ;-)

Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-11-29 Thread Bill Janssen
I think the modern Mac equivalent goes something like this: def uti_for_file(path): import os from AppKit import NSWorkspace uti, err = NSWorkspace.sharedWorkspace().typeOfFile_error_( os.path.realpath(path), None) if err: raise Exception(unicode(err)) else:

Re: [Pythonmac-SIG] Creator, type and other means of file detection

2008-11-29 Thread Henning Hraban Ramm
Am 2008-11-29 um 20:15 schrieb Bill Janssen: I think the modern Mac equivalent goes something like this: def uti_for_file(path): import os from AppKit import NSWorkspace uti, err = NSWorkspace.sharedWorkspace().typeOfFile_error_( os.path.realpath(path), None) if err: