[Pythonmac-SIG] Creator, type and other means of file detection
Nicholas Riley
njriley at uiuc.edu
Mon Dec 1 20:02:28 CET 2008
On Mon, Dec 01, 2008 at 07:34:37PM +0100, Henning Hraban Ramm wrote:
> Ok, but how can I convert those Ints to string?
> I get them as Ints also from UTGetOSTypeFromString:
>
> >>> from LaunchServices import UTGetOSTypeFromString
> >>> UTGetOSTypeFromString('public.jpeg')
> 1886741100
>>> from LaunchServices import UTGetOSTypeFromString
>>> ostype = UTGetOSTypeFromString('public.jpeg')
>>> ('%x' % ostype).decode('hex')
'publ'
I don't think that is what you want though. Instead, use:
>>> import LaunchServices
>>> LaunchServices.UTTypeCopyPreferredTagWithClass('public.jpeg', LaunchServices.kUTTagClassOSType)
u'JPEG'
--
Nicholas Riley <njriley at uiuc.edu> | <http://www.uiuc.edu/ph/www/njriley>
More information about the Pythonmac-SIG
mailing list