The popen call in the below example is bad -- don't use that, it will totally explode if either path has spaces in it. You want to use the subprocess module instead. It comes with Python 2.4, but you can just copy subprocess.py over if you're using Python 2.3. The subprocess module avoids quoting altogether by taking a list for arguments and passing it directly to execve after the fork.
The second example does try to quote, but it doesn't do it correctly. Quotes are valid in paths, so the second snippet would explode if the path had a quote in it (unlikely.. but possible). I would also recommend against using FixupResourceForks if it requires dev tools to be installed. -bob On Jan 18, 2006, at 1:03 PM, Dimi Shahbaz wrote: > Yes, I think I'm going to have to do this. > > One question though, since you are using an external process to fix > the metadata anyway, why not just use ditto again to unzip, so you > could avoid the extra unzip step? > > -Dimi > > > On Jan 18, 2006, at 8:40 AM, Charles Chandler wrote: > >> 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 > > _______________________________________________ > Pythonmac-SIG maillist - Pythonmac-SIG@python.org > http://mail.python.org/mailman/listinfo/pythonmac-sig _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig