[Pythonmac-SIG] Resource forks and HFS-metadata

Charles Chandler charles at nemetschek.net
Wed Jan 18 17:40:06 CET 2006


I use ditto to create zips...

openObj = popen2.Popen4('ditto -c -k --keepParent -sequesterRsrc ' +
sourceFolderName + ' ' + targetZipName)

...then the zipfile method to unzip the files...

data = theZipFile.read(relPathAndFileName)
outfile = open(fullTargetName, "wb")
outfile.write(data)
outfile.close()

...then a Mac BSD call to rebuild the data and resource forks...

popen2.popen2("/System/Library/CoreServices/FixupResourceForks \"" +
destination + "\"")

...assuming that the developer tools are installed.

Charles



> -----Original Message-----
> From: pythonmac-sig-bounces+charles=nemetschek.net at python.org
> [mailto:pythonmac-sig-bounces+charles=nemetschek.net at python.org] On Behalf
> Of Henning Hraban Ramm
> Sent: Wednesday, January 18, 2006 10:52
> To: pythonmac-sig at python.org
> Subject: Re: [Pythonmac-SIG] Resource forks and HFS-metadata
> 
> Am 2006-01-18 um 02:01 schrieb Dimi Shahbaz:
> 
> > My program deals with zip transferring archives.  I'm curious as to
> > whether Python (namely the 'zip' and 'zipfile') modules can be made
> > to be aware of resource forks and HFS-metadata?  Or is this a
> > limitation of the zip format itself?  According to this (old) hint:
> 
> I experienced that the zipfile module doesn't work at all (at least
> in Python 2.3); the files were often broken (i.e. no other zip
> program could open them), and it couldn't handle a lot of zip files
> by other apps.
> AFAIK the only *known* limitation is with really huge files, though.
> 
> Thus I always use an external app for archive handling, even if I
> don't like that approach.
> 
> Grüßlis vom Hraban!
> ---
> http://www.fiee.net/texnique/
> http://contextgarden.net
> http://www.cacert.org (I'm an assurer)
> 
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG at python.org
> http://mail.python.org/mailman/listinfo/pythonmac-sig



More information about the Pythonmac-SIG mailing list