[Pythonmac-SIG] How do I set type and creator?

Just van Rossum just at letterror.com
Wed Nov 19 03:39:08 EST 2003


Bob Ippolito wrote:

> 
> On Nov 18, 2003, at 7:32 PM, Chris Barker wrote:
> 
> > I need to set the type and creator for a file I just created. I used 
> > to be abel to do this with:
> >
> > import macfs
> > mac_file = macfs.FSSpec(MyfilePath)
> > mac_file.SetCreatorType('COSM','.SAV')
> >
> > Now it looks like I want to use the Carbon.File module, but I'm 
> > getting lost in the details:
> >
> > File.FSMakeFSSpec() requires a volume reference number and directory 
> > ID...I have no idea where to get those. I'm a bit lost in the Inside 
> > Macintosh references. There has to be an easy way to do this!!
> 
> I dunno, but this should work if you have PyObjC:
[ ...snip... ]

Actually, the best and easiest way is through MacOS.GetCreatorAndType()
and MacOS.SetCreatorAndType().

Just



More information about the Pythonmac-SIG mailing list